Hi Folks,
I am stuck with a basic scenario and hoping to get some guidance. I'm using prefect 2.13.0. Below mentioned is my code.
I want that task2 should be dependent on task1's success status(return 1) only. Also, we cannot remove try-catch error handling due to other technical requirements.
Copy code
from prefect import task, flow
@task
def task1():
try:
## do some transformation here
return "1"
except Exception as e:
return "0",e
@task(log_prints=True)
def task2():
try:
## do more transformation here
return "1"
except Exception as e:
return "0",e
@flow
def main():
out1 = task1(return_state=True)
print(out1)
out2 = task2(wait_for=out1)
if __name__ == "__main__":
main()
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.