An Hoang
09/01/2021, 3:28 PMParameter
as the default for another? Here's what I did
#task
@task(target= {output_folder_path}/result)
def example_task(output_folder_path)
....
#in flow
step1_folder_path = Parameter("step1_folder_path")
output_folder_path = Parameter("output_folder_path", default = step1_folder_path)
When I do this, I got a warning
<ipython-input-226-3b472991f1ef>:8: UserWarning: A Task was passed as an argument to Parameter, you likely want to first initialize Parameter with any static (non-Task) arguments, then call the initialized task with any dynamic (Task) arguments instead. For example:
my_task = Parameter(...) # static (non-Task) args go here
res = my_task(...) # dynamic (Task) args go here
see <https://docs.prefect.io/core/concepts/flows.html#apis> for more info.
output_folder_path = Parameter("output_folder_path", default = step1_folder_path)
When I execute the flow, it runs but the target
doesn't work as intended, the task still runs every time even though the target files are there. When I provide a hardcoded string to the default of output_folder_path
, everything works fineKevin Kho
output_folder_path
to None
make another task that checks for the output_folder_path
to see if it’s None
and then grab step1_folder_path
.