Two quick questions: within a flow (using the impe...
# prefect-community
Two quick questions: within a flow (using the imperative API), how can I view reference tasks? And how can I set a task to be a reference task or not? My code currently consists of using
. Specifically, I want to make sure that any of my triggers are dependent only the tasks that I think they really are. For example, in my pipeline (image attached), I want the trigger for the next task that will come off of the valid_unit_reducer to be triggered by
for the valid_unit_reducer and not by
on the invalid_unit_reducer. Maybe this is the default behavior in Prefect, but my current understanding is that triggers are related to all tasks and not just the upstream task immediately before it
Hey @Kyle McEntush, Using the imperative API, you can retrieve tasks programmatically from a flow with
flow.get_tasks(name='my task')
, Additionally, triggers are related to upstream tasks, not all tasks in a flow. You can specify the scope of tasks you'd like to trigger upon by listing them out in your
upstream_tasks=[task_1, task_2, task_3]
. Other ways to set up your reference tasks is to use
, or
, which you can read about in the API documentation (though you'll have to scroll down).
Got it. Really appreciate all of your help today!
👍 1