Paolo
08/18/2021, 4:06 PM@task("A small task"))
def small_task(some_params):
# stuff happens here
return something
@task("A complex task with many steps")
def complex_task(lots_of_params):
# stuff happens
# more stuff happens
small_task_result = small_task(some_params)
# even more stuff happens which uses small_task_result
My question is: what happens if I nest tasks as above? I suspect prefect would not like it, but I haven't set up a test infrastructure yet.
Of course, I could use small_task as a simple function (remove the @task decorator), or break up complex_task in smaller tasks, but both solutions would mean for me to either leave things as they are (awful) or rewrite a lot of code.Kevin Kho
task.run()
, this will just run the Python underneath but it’s not treated as a task in a sense that Prefect won’t keep track of the state of that specific action.
If that’s fine, it likely doesn’t have to be a task and can just be a function also.Paolo
08/18/2021, 4:15 PM