Maybe this is a stupid question. But is it possibl...
# flyte-support
s
Maybe this is a stupid question. But is it possible to somehow within the workflow create dependencies between tasks without connecting them with input and output? example:
Copy code
from flytekit import task, workflow


@task
def task_a() -> None:
  print("task_a")


@task
def task_b() -> None:
  print("task_b")


@task
def task_c() -> None:
  print("task_c")


@workflow
def my_wf() -> None:
  task_a()
  task_b()
  task_c()
this workflow would run task_a, task_b and task_c in parallel. But i want them to run sequentially.
We found this solution:
Copy code
@workflow
def my_wf() -> None:
    task_a().runs_before(task_b().runs_before(task_c()))
Is there any other solution to this which is less bloaty?
f
cc @broad-monitor-993 this is an often asked question
s
Thanks @freezing-airport-6809 🙏 Would be nice if it was possible to chain the promises multiple times eg.
Copy code
promise1 >> promise2 >> promise3 >> promise4
or even the tasks:
Copy code
task1() >> task2() >> task3() >> task4()
f
I think it can be
Have you tried
I think both are overloaded
s
yes i get this error:
Copy code
TypeError: unsupported operand type(s) for >>: 'NoneType' and 'VoidPromise'
this is the code i am using:
Copy code
from time import sleep

from flytekit import task, workflow


@task
def task_a():
    sleep(4)
    print("task_a")


@task
def task_b():
    sleep(1)
    print("task_b")


@task
def task_c():
    print("task_c")


@workflow
def my_wf():
    promise1 = task_a()
    promise2 = task_b()
    promise3 = task_c()

    promise1 >> promise2 >> promise3


if __name__ == "__main__":
    my_wf()
t
I don’t think that’s possible today. cc: @glamorous-carpet-83516 @high-accountant-32689
t
@silly-jelly-43096 would you mind making an issue for this?
s
sure i can create it
it seems like i am not able to create issues for flytekit project. I can not see the "issues"-tab when i am in the repo (https://github.com/flyteorg/flytekit).
g
we manage flytekit issue in flyte repo. https://github.com/flyteorg/flyte/issues
👍 1
s
g
Thank you
162 Views