Bruno Murino
06/30/2021, 2:03 PMimport prefect
from prefect import task, Flow, Parameter, unmapped, case
from prefect.tasks.shell import ShellTask
shell_task = ShellTask(stream_output=True)
@task
def get_config():
return {
'path': '/root/',
}
with Flow("test") as flow:
config = get_config()
bar = shell_task(command="pwd", helper_script = f"cd {config['path']}")
flow.run()
Kevin Kho
06/30/2021, 2:06 PMconfig['path']
to pull yet. In this case you need an intermediate task that takes in config
and pulls out the path
and returns it.Bruno Murino
06/30/2021, 2:06 PMKevin Kho
06/30/2021, 2:20 PMtask(lambda _x_: x['path'])(config)