Maybe this is a stupid question. But is it possibl...
# ask-the-community
r
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?
cc @Niels Bantilan this is an often asked question
r
Thanks @Ketan (kumare3) 🙏 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()
k
I think it can be
Have you tried
I think both are overloaded
r
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()
s
I don’t think that’s possible today. cc: @Kevin Su @Eduardo Apolinario (eapolinario)
y
@Robin Eklund would you mind making an issue for this?
r
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).
k
we manage flytekit issue in flyte repo. https://github.com/flyteorg/flyte/issues
r
k
Thank you
159 Views