def run_ramp(): def f(): _stop_run = False o = bilt.Bilt() pynedm.write_document_to_db({ "type" : "data", "value" : { "ramp_running" : 1 } }) o.run_ramp() while (int(o.read_macro_state()) == 2): time.sleep(1.) pynedm.write_document_to_db({ "type" : "data", "value" : { "ramp_running" : 0 } }) pynedm.start_process(f)
def start_measure(): global _running, _myprocess if _myprocess is not None: raise Exception("Measurement already running") _running = True _myprocess = pynedm.start_process(_measure) return True
def start_process(*args): """ Start the long process """ global _my_process if _my_process is not None: raise Exception("Process already running!") _my_process = pynedm.start_process(long_function, *args) return True
def run_deg(t): print("listener run_deg called") def f(): print(_dg.isrunning()) print("run_deg called with t = {}".format(t)) print(po.write_document_to_db( { "type": "data", "value": {"degaussing_state": 1} })) _dg.run_deg(t) print(po.write_document_to_db( { "type": "data", "value": {"degaussing_state": 0} })) print("run_deg done") if _dg.isrunning(): print("in progress") raise Exception("Degaussing in progress") pynedm.start_process(f) return True