https://prefect.io logo
a

Alex Koay

01/05/2021, 3:03 AM
How do I run a task from another task?
c

Chris White

01/05/2021, 3:32 AM
Hi Alex - assuming you want access to another task’s runtime logic, you can do:
Copy code
@task
def my_main_task():
    output = other_task.run() # this runs another task
    ...
note that I interpreted you to mean “re-use logic from another task” -
other_task
in my example will not show up in the Prefect UI or be orchestrated / retried / etc by Prefect in this example
a

Alex Koay

01/05/2021, 3:49 AM
ah thanks for the info! yeah I wanted to re-use the logic from another task
c

Chris White

01/05/2021, 3:50 AM
awesome - anytime!
8 Views