Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow blocking nested workflow #1220

Closed
BoPeng opened this issue Feb 23, 2019 · 4 comments
Closed

Disallow blocking nested workflow #1220

BoPeng opened this issue Feb 23, 2019 · 4 comments

Comments

@BoPeng
Copy link
Contributor

BoPeng commented Feb 23, 2019

#1167 Implements a way to run nested workflows concurrently, with the limitations that only workflows that are the last statement can be concurrent, and multiple workflows in sos_riun(['A', 'B']) can be concurrent but blocks the step executor.

However, with the new strict -j worker implementation, sos_run('A') not as the last statement will make the worker wait for the completion of A,

sos_run('A')
other_func()

So in the case of -j1, sos_run('A') will take one worker and the workflow will hang forever.

I would suggest that we disallow the execution of blocking nested workflow so that there will be no waiting process.

@gaow
Copy link
Member

gaow commented Feb 23, 2019

I'm not sure if I understand it.

multiple workflows in sos_riun(['A', 'B']) can be concurrent but blocks the step executor.

block means to hang until completion of both A and B?

I would suggest that we disallow the execution of blocking nested workflow so that there will be no waiting process.

Will it impact parallel execution of sos_riun(['A', 'B'])?

@BoPeng
Copy link
Contributor Author

BoPeng commented Feb 23, 2019

OK, In the case of

whatever
sos_run('A')

or

whatever
sos_run(['A', 'B'])

the step statement can be completed (no waiting) and the step can yield (do something else) while waiting for the completion of workflows A and B. In the case of

sos_run('A')
whatever

or

sos_run(['A', 'B'])
whatever

the statement will send out workflows to be executed, but the step is blocking so nothing else can be run on the worker. Basically I am trying to make all sos statements non-blocking so that they can use the workers more efficiently and prevent deadlock.

@BoPeng
Copy link
Contributor Author

BoPeng commented Feb 23, 2019

OK, right now I just give a warning because I have some workflows like

sos_run('A')
sos_run('B')
sos_run('C')

which should be written as

sos_run(['A', 'B', 'C'])

or

sos_run('A + B + C')

if execution order matters but a warning will let the workflows run.

@BoPeng
Copy link
Contributor Author

BoPeng commented Feb 24, 2019

Final solutIon: sos will create a separate process for each blocking subworkflow, and shut it down when the workflow is completed. This means there is still a chance for sos to have more than -j + 1 processes but this is better than having sos hang forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants