I am trying to run a task after an apply_map, but ...
# ask-community
t
I am trying to run a task after an apply_map, but I am unsure how to link it up. It keeps running first with no upstream tasks.
Copy code
with Flow(
    "AWS CUR import",
    result=GCSResult(bucket="platformsh-vendor-prefect"),
    state_handlers=[flow_failure],
) as flow:
    # save_file = prefect.Parameter("Download Files", default=False)
    num_periods = prefect.Parameter("num_periods", default=4)
    periods = generate_periods(num_periods)
    apply_map(run_or_bail, periods)
    clear_files()
I have tried using
task.set_dependencies()
but I can't figure out what the upstream task should be in this context. The flow visualization doesn't look right each time
k
I think the
task.set_dependencies
might have to go inside the tasks in
run_or_bail
because
apply_map
is a function that calls another function to add those tasks.
t
ok, i will look to do the final task another way. Thank you.