Philip MacMenamin
01/12/2021, 1:10 AM@task(trigger=prefect.triggers.always_run) # one new line
def tear_down_cluster(cluster):
if all_successful:
print(":)")
else:
print(":-/")
Kyle Moon-Wright
01/12/2021, 1:18 AMalways_run
trigger to a task with conditional logic. Here’s a great example in the documentation of taking two courses of action based on the final state of task_a
, giving you granular visibility across the final states of your tasks and the logic engaged.upstream_tasks
kwarg to ensure that task always runs first.Philip MacMenamin
01/12/2021, 1:24 AMKyle Moon-Wright
01/12/2021, 1:33 AMdef post_to_slack(task, old_state, new_state):
if new_state.is_successful():
pass
if new_state.is_failed():
pass
return new_state
Philip MacMenamin
01/12/2021, 1:36 AMKyle Moon-Wright
01/12/2021, 1:45 AM