mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 02:20:02 +02:00
feat: added config option to abort on ctrl_c; closes #95
This commit is contained in:
parent
c10c43df3a
commit
705daa6d9e
@ -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,),
|
||||
|
@ -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)
|
||||
|
@ -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: ./
|
||||
|
Loading…
x
Reference in New Issue
Block a user