pnpnpn / timeout-decorator

Timeout decorator for Python
MIT License
628 stars 95 forks source link

Can't be used in AWS Lambda #51

Open yilinjuang opened 6 years ago

yilinjuang commented 6 years ago

When setting use_signal to False, it uses multiprocessing.Queue which isn't support in AWS Lambda. Are we gonna have other approach to not use signal? Maybe use multiprocessing.Pipe? Thanks

AWS Document: https://aws.amazon.com/blogs/compute/parallel-processing-in-python-with-aws-lambda/

pnpnpn commented 6 years ago

Good point. Do you want to make a PR for that?

yilinjuang commented 6 years ago

Sure. How about adding another argument other than use_signal? Or change the implementation inside use_signal?

bitranox commented 6 years ago

can You provide a code snippet to test please

yilinjuang commented 6 years ago

@bitranox any lambda can reproduce the issue. Can refer to here and here for how to create one.

bitranox commented 6 years ago

ok, I changed the implementation to use multiprocess.pipe (halfduplex). It is faster, more elegant and probably can work with AWS (let me know). See : https://github.com/bitranox/wrapt-timeout-decorator or https://github.com/pnpnpn/timeout-decorator/pull/53 yours sincerely Robert