Python six.moves._thread.interrupt_main() Examples
The following are 4
code examples of six.moves._thread.interrupt_main().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
six.moves._thread
, or try the search function
.
Example #1
Source File: timeout.py From python-lambda-local with MIT License | 6 votes |
def time_limit(seconds): if hasattr(signal, "SIGALRM"): def signal_handler(signum, frame): raise TimeoutException("Timeout after {} seconds.".format(seconds)) signal.signal(signal.SIGALRM, signal_handler) signal.alarm(seconds) try: yield finally: signal.alarm(0) else: timer = threading.Timer(seconds, lambda: _thread.interrupt_main()) timer.start() try: yield except KeyboardInterrupt: raise TimeoutException("Timeout after {} seconds.".format(seconds)) finally: timer.cancel()
Example #2
Source File: web.py From Table-Detection-using-Deep-learning with BSD 3-Clause "New" or "Revised" License | 5 votes |
def start_network(config): global PREDICTOR_NETWORK try: PREDICTOR_NETWORK = PredictorNetwork(config) except Exception as e: # An error occurred loading the model; interrupt the whole server. tf.logging.error(e) _thread.interrupt_main()
Example #3
Source File: web.py From Tabulo with BSD 3-Clause "New" or "Revised" License | 5 votes |
def start_network(config): global PREDICTOR_NETWORK try: PREDICTOR_NETWORK = PredictorNetwork(config) except Exception as e: # An error occurred loading the model; interrupt the whole server. tf.logging.error(e) _thread.interrupt_main()
Example #4
Source File: web.py From luminoth with BSD 3-Clause "New" or "Revised" License | 5 votes |
def start_network(config): global PREDICTOR_NETWORK try: PREDICTOR_NETWORK = PredictorNetwork(config) except Exception as e: # An error occurred loading the model; interrupt the whole server. tf.logging.error(e) _thread.interrupt_main()