timeout-decorator icon indicating copy to clipboard operation
timeout-decorator copied to clipboard

Can't be used in AWS Lambda

Open yilinjuang opened this issue 7 years ago • 5 comments

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/

yilinjuang avatar Sep 10 '18 10:09 yilinjuang

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

pnpnpn avatar Sep 10 '18 14:09 pnpnpn

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

yilinjuang avatar Sep 10 '18 15:09 yilinjuang

can You provide a code snippet to test please

bitranox avatar Sep 11 '18 05:09 bitranox

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

yilinjuang avatar Sep 12 '18 12:09 yilinjuang

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

bitranox avatar Sep 13 '18 16:09 bitranox