Hi, Quick Question:
How i can use the parameter input as a string outside a task.
When i try it , i get a parameter object <Parameter: example>
Copy code
with Flow("example-flow") as flow:
example_param = Parameter('example')
print(example_param)
Thanks for your help!!
z
Zanie
01/20/2021, 11:29 PM
Hi! The short answer is that you can’t. The Parameter is intended to be resolved at flow runtime and anything that’s outside a task is executed at flow definition time.
Zanie
01/20/2021, 11:30 PM
If you absolutely want to print the value of that parameter at flow definition time, you can use
print(example_param.run())
l
Luis Gallegos
01/20/2021, 11:35 PM
I Understand. So i intend to do is change the run_flow_name with the parameter input like this:
Copy code
with Flow("example-flow") as flow:
example_param = Parameter('example')
current_time = datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
run_name = f"{example_param} - {current_time}"
rename_flow = RenameFlowRun(flow_run_name=run_name)
I try it inside a task, but doesn't work. (Any suggest?)
I will try with the
run
method. Thanks
z
Zanie
01/20/2021, 11:37 PM
You’ll need to generate the name in a task, here you’re both getting the current time and formatting a string at flow definition time rather than runtime.
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.