feat: added config option to abort on ctrl_c; closes #95

This commit is contained in:
wakonig_k 2023-10-31 20:40:37 +01:00
parent c10c43df3a
commit 705daa6d9e
3 changed files with 13 additions and 4 deletions

View File

@ -114,8 +114,14 @@ class SigintHandler(SignalHandler):
return
# - Ctrl-C twice within 10 seconds or a direct command (e.g. mv) -> hard pause
if self.bec._service_config.abort_on_ctrl_c:
print("The scan will be aborted.")
threading.Thread(
target=self.bec.queue.request_scan_abortion,
daemon=True,
).start()
raise ScanInterruption("User abort.")
print("A hard pause will be requested.")
threading.Thread(
target=self.bec.queue.request_scan_interruption,
args=(False,),

View File

@ -97,3 +97,7 @@ class ServiceConfig:
@property
def mongodb(self):
return self._load_urls("mongodb", required=False)
@property
def abort_on_ctrl_c(self):
return self.service_config.get("abort_on_ctrl_c", True)

View File

@ -9,9 +9,8 @@ scibec:
port: 3030
beamline: TestBeamline
service_config:
general:
reset_queue_on_cancel: True
enforce_ACLs: False
abort_on_ctrl_c: False
enforce_ACLs: False
file_writer:
plugin: default_NeXus_format
base_path: ./