Maria
01/31/2024, 2:15 AMMarvin
01/31/2024, 2:15 AM.submit()
method to queue up tasks within a flow, enabling one task to trigger the execution of another. Here's a simplified example from the documentation:
python
from prefect import flow, task
@task
def say_hello(name):
print(f"Hello {name}")
@task
def say_goodbye(name):
print(f"Goodbye {name}")
@flow
def greetings(names):
for name in names:
say_hello.submit(name)
say_goodbye.submit(name)
if __name__ == "__main__":
greetings(["arthur", "trillian", "ford", "marvin"])
In this code snippet, the greetings
flow triggers the say_hello
and say_goodbye
tasks for each provided name. Tasks are submitted for execution with the submit
method inside the flow definition.
You can find more detailed information and examples in the Prefect documentation.