X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=remote_worker.py;h=42aeb854ce633b47e1f1be85b40bce8bf8d436f6;hb=2c43e31aae1138f79c30619cde25746e41390152;hp=bf8de6c66a36767ac267cfdd2bffe38317cbace0;hpb=9821d383ba3de886f8d11d00a588e49c2c280579;p=python_utils.git diff --git a/remote_worker.py b/remote_worker.py index bf8de6c..42aeb85 100755 --- a/remote_worker.py +++ b/remote_worker.py @@ -51,9 +51,6 @@ cfg.add_argument( @background_thread def watch_for_cancel(terminate_event: threading.Event) -> None: - if platform.node() == 'VIDEO-COMPUTER': - logger.warning('Background thread not allowed on retarded computers, sorry.') - return logger.debug('Starting up background thread...') p = psutil.Process(os.getpid()) while True: @@ -83,7 +80,9 @@ def main() -> None: in_file = config.config['code_file'] out_file = config.config['result_file'] - (thread, stop_thread) = watch_for_cancel() + stop_thread = None + if config.config['watch_for_cancel']: + (thread, stop_thread) = watch_for_cancel() logger.debug(f'Reading {in_file}.') try: @@ -129,8 +128,9 @@ def main() -> None: stop_thread.set() sys.exit(-1) - stop_thread.set() - thread.join() + if stop_thread is not None: + stop_thread.set() + thread.join() if __name__ == '__main__':