Hello All,
Is there a way to define a placeholder on a defined Parameter from the Cloud UI interface? I’d want prefect to fill the place holder at the run time basically!
k
Kevin Kho
08/03/2021, 4:43 PM
Hey @Mehdi Nazari, you can do this my going to the Flow page then Settings then Parameters and you can set default Parameters there that will override the defaults you registered with.
You can also create a Schedule under settings and attach the Parameter to the schedule.
m
Mehdi Nazari
08/03/2021, 4:46 PM
Thanks @Kevin Kho, I’m talking about a place holder in a Parameter! What I have in mind is to append date to a parameter that gets passed to a flow?
k
Kevin Kho
08/03/2021, 4:53 PM
I am a bit unclear what you mean with the placeholder in a Parameter since the Parameter is a placeholder? Will try to answer though, the parameter has to be registered on the Flow side in code. This can’t be done through the UI.
Kevin Kho
08/03/2021, 4:55 PM
Also if you have something like
Copy code
now = Parameter("now", datetime.datetime.now())
then the datetime.datetime.now() will be evaluated during the build time and the date will be pinned during serialization. Instead you can do something like
Copy code
now = Parameter("now", default="now")
and then use a task
Copy code
@task
def get_now(time):
if time == "now":
return datetime.datetime.now()
m
Mehdi Nazari
08/03/2021, 4:58 PM
Lets get this clear, this is what a normal Parameter on the UI looks like:
Mehdi Nazari
08/03/2021, 4:59 PM
This is what I have in mind, ideally, the CURRENTDATE will get filled by Prefect at scheduled run time.
k
Kevin Kho
08/03/2021, 5:23 PM
I think it’s not clear where this interpolation would come from. I think if you want to do this, you can use the
context
inside your flow and pull out the relevant values.
👍 1
m
Mehdi Nazari
08/03/2021, 8:35 PM
I can show you what I mean if you’re interested. The community will benefit from it if this is implemented.
k
Kevin Kho
08/03/2021, 8:44 PM
I know what you mean. Will bring this up to the team but the short answer is there is I don’t think we would include the Parameter input or task input as a temptable field.
The templating is a mechanism to template objects that need to be specified during build time, but actually get populated during runtime. For example, result location or task name. Templating these would get injected during runtime. It’s to provide the bridge of filling values of stuff that needs to be “built”.
In this case though the input to the task or Parameter isn’t created at build time. It’s all deferred so I don’t think we would template that. This seems like something better handled by flow logic rather than Prefect injecting values to support the Flow.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.