Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91088

Re: decorators and alarms

References <CANy1k1gkXuTKEPL-ku7+c8mCysGgPgb62ZAgDdCrXXs6Z1S8Yg@mail.gmail.com>
Date 2015-05-22 21:20 -0600
Subject Re: decorators and alarms
From Jason Friedman <jsf80238@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.250.1432351246.17265.python-list@python.org> (permalink)

Show all headers | View raw


> But, I'd like to expand this to take some generic code, not just a
> shell command, and terminate it if it does not return quickly.
>
> @time_limiter
> def generic_function(arg1, arg2, time_limit=10):
>     do_some_stuff()
>     do_some_other_stuff()
>     return val1, val2
>
> If generic_function does not finish within 10 seconds it would stop
> executing and throw an exception.

Found an answer:
https://wiki.python.org/moin/PythonDecoratorLibrary#Function_Timeout

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: decorators and alarms Jason Friedman <jsf80238@gmail.com> - 2015-05-22 21:20 -0600
  Re: decorators and alarms Paul Rubin <no.email@nospam.invalid> - 2015-05-22 20:43 -0700

csiph-web