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

Task timeout #24

Closed
muchas opened this issue Jan 30, 2020 · 4 comments · Fixed by #32
Closed

Task timeout #24

muchas opened this issue Jan 30, 2020 · 4 comments · Fixed by #32

Comments

@muchas
Copy link

muchas commented Jan 30, 2020

Hi there,

Great project, thanks for your work!

Do you have any way to force the timeout on long running tasks?

pr.map(fn, stage, timeout=3)  # fn would time out after 3 seconds and skip the computation
@cgarciae
Copy link
Owner

@muchas I've been thinking of implementing something like this for the pr module because for some reason sometimes a process randomly hangs. What is your use case?

@muchas
Copy link
Author

muchas commented Jan 30, 2020

@cgarciae My pipeline contains nondeterministic, computationally expensive function which for most elements runs fast enough, but for some of them it takes too much time, blocking available processes. I'm fine with filtering those elements out.

Till now I was using pebble decorator:

@concurrency.process(timeout=5)
def possibly_long_computation():
    ...

However the above solution does not combine well with pypeln as I'm getting the following error:

AssertionError: daemonic processes are not allowed to have children

Thank you for looking into it!

EDIT:
pebble solution seems to work with threads

@cgarciae
Copy link
Owner

I'll try to implement this soon. I'll been doing a refactor + documentation improvement so I didn't want to add new stuff, but this feature seems very useful.

@cgarciae cgarciae mentioned this issue Mar 15, 2020
@cgarciae
Copy link
Owner

Checkout the new timeout parameter for most functions in the pypeln API, e.g pl.process.map

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

Successfully merging a pull request may close this issue.

2 participants