Mehdi Nazari

    Mehdi Nazari

    1 year ago
    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!
    Kevin Kho

    Kevin Kho

    1 year ago
    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.
    Mehdi Nazari

    Mehdi Nazari

    1 year ago
    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?
    Kevin Kho

    Kevin Kho

    1 year ago
    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.
    Also if you have something like
    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
    now = Parameter("now", default="now")
    and then use a task
    @task
    def get_now(time):
        if time == "now":
           return datetime.datetime.now()
    Mehdi Nazari

    Mehdi Nazari

    1 year ago
    Lets get this clear, this is what a normal Parameter on the UI looks like:
    This is what I have in mind, ideally, the CURRENTDATE will get filled by Prefect at scheduled run time.
    Kevin Kho

    Kevin Kho

    1 year ago
    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.
    Mehdi Nazari

    Mehdi Nazari

    1 year ago
    I can show you what I mean if you’re interested. The community will benefit from it if this is implemented.
    Kevin Kho

    Kevin Kho

    1 year ago
    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.