Adds some doctests to decorators.
[python_utils.git] / remote_worker.py
index bf8de6c66a36767ac267cfdd2bffe38317cbace0..0086c40b0379ce680383c3b4e723bdc92b3bec0a 100755 (executable)
@@ -83,7 +83,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 +131,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__':