Ed Burroughes
03/27/2023, 3:16 PM@task(result=PrefectResult())
def return_results(table_name):
return {"table_name": table_name)
2. Running the task no matter the upstream state using trigger=all_finished:
@task(result=PrefectResult(), trigger=all_finished)
def return_results(table_name):
return {"table_name": table_name)
Can anyone point me in the right direction to the equivalent Prefect 2 features, thank you 🙂Zanie
@task(persist_result=True)
and
my_task(x=1, y=allow_failure(upstream_task))
Zanie
Ed Burroughes
03/27/2023, 3:21 PMEd Burroughes
03/28/2023, 1:09 PM_return_results = return_results(
table_name,
trigger_s3_key,
cleaned_aux_file_path,
str(flow_run_obj.flow_run.id),
wait_for=[
allow_failure(csv_file),
allow_failure(csv_dialect),
allow_failure(table_obj),
allow_failure(_drop_table),
allow_failure(_create_table),
allow_failure(_load_data),
allow_failure(_shrink_columns),
])
Is there a nicer way to allow_failure on all upstream tasks in prefect 2?Ed Burroughes
03/28/2023, 1:18 PMZanie
Zanie
from prefect import flow, task, allow_failure
@flow
def my_flow():
x = fail_task.submit()
y = fail_task.submit()
my_task(wait_for=[allow_failure(u) for u in (x, y)])
return True
@task(log_prints=True)
def my_task():
print("hi")
@task
def fail_task():
raise ValueError()
my_flow()