kiran
09/01/2022, 9:56 PMConcurrent
or Sequential
? In one section, the docs say the default is Concurrent
but then in another section, they say “Make sure you use .submit()
to run your task with a task runner. Calling the task directly, without .submit()
, from within a flow will run the task sequentially instead of using a specified task runner.” which seems to imply that the default is actually Sequential
Khuyen Tran
09/01/2022, 9:57 PM.submit
.submit
, the tasks will run sequentiallykiran
09/01/2022, 9:58 PM@task
def say_hello(name):
print(f"hello {name}")
@task
def say_goodbye(name):
print(f"goodbye {name}")
@flow(task_runner=SequentialTaskRunner())
def greetings(names):
for name in names:
# say_hello.submit(name)
# say_goodbye.submit(name)
say_hello(name)
say_goodbye(name)
greetings(["arthur", "trillian", "ford", "marvin"])
Khuyen Tran
09/01/2022, 9:59 PMkiran
09/01/2022, 10:00 PM@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(name)
say_goodbye(name)
greetings(["arthur", "trillian", "ford", "marvin"])
Khuyen Tran
09/01/2022, 10:19 PMterrence
09/02/2022, 1:31 AM.submit()
to use a task runner.
2. Even if you import and specify a task runner on the flow, if you don’t submit
, it’s not submitted to the task runner.