sark
09/15/2020, 7:15 AMdef container(p):
return CreateContainer(image_name="image", command=f"--p={p}")
start = StartContainer()
with Flow("flow") as flow:
p = Parameter('param', required=True)
c = container(p)
start_container = start(container_id=c)
i get <Parameter: p>
interpolated for p
instead of the actual value for p
but if i make container
a @task
it also gives weird errors i think because CreateContainer
is itself already a task?CreateContainer
depends on the output of Parameter
start
instead like this
@task
def start(i):
return StartContainer(container_id=i)
and add @task
to container
alsoUnexpected error: ValueError('Could not infer an active Flow context.')
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/prefect/engine/runner.py", line 48, in inner
new_state = method(self, state, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 822, in get_task_run_state
value = timeout_handler(
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/executors.py", line 188, in timeout_handler
return fn(*args, **kwargs)
File "crdf.py", line 65, in start
File "/usr/local/lib/python3.8/site-packages/prefect/core/task.py", line 475, in __call__
new.bind(
File "/usr/local/lib/python3.8/site-packages/prefect/core/task.py", line 528, in bind
raise ValueError("Could not infer an active Flow context.")
ValueError: Could not infer an active Flow context.
because it should have been StartContainer()(container_id=i)