Chris Jordan
01/05/2021, 3:15 PMStartFlowRun
? I've got a task
spawn_time_series_import = StartFlowRun(
project_name="python_imports",
flow_name="blast_metric_series_flow")
which takes an argument
spawn = spawn_time_series_import(
parameters=dict(action_id=blast_id))
and a task that returns a list of `blast_id`s with which I want to spawn many flows
blast_id_list = push_records_to_summary_table(imported)
I want to put all this together in something like this, but I'm having trouble finding the right syntax
spawn_time_series_import = StartFlowRun(
project_name="python_imports",
flow_name="blast_metric_series_flow")
with Flow("blast_import_flow",
schedule=daily_schedule,
state_handlers=[cloud_only_slack_handler]
) as flow:
[[[stuff]]]
blast_id_list = push_records_to_summary_table(imported)
spawn = spawn_time_series_import.map(
parameters=dict(action_id=blast_id_list))
is there an accepted syntax for this?Jenny
01/05/2021, 4:12 PMChris Jordan
01/05/2021, 4:17 PMStartFlowRun
. If I had used a task instead of a flow for this, I could use map (and that is my fallback plan), but I would prefer to have each of these be their own flow run if possible.Zanie
import prefect
from prefect import task, Flow
tasks = [i for i in range(3)]
@task
def display(params):
<http://prefect.context.logger.info|prefect.context.logger.info>(f"{params['i']}")
with Flow("mapped") as flow:
display.map(params=dict(i=tasks))
flow.run()
import prefect
from prefect import task, Flow
tasks = [i for i in range(3)]
@task
def display(params):
<http://prefect.context.logger.info|prefect.context.logger.info>(f"{params['i']}")
@task
def package_into_params(i):
return dict(i=i)
with Flow("mapped") as flow:
packaged_values = package_into_params.map(tasks)
display.map(params=packaged_values)
flow.run()
Chris Jordan
01/05/2021, 4:45 PM