From 8a3143bb2fe694cf3a43756fe28e83449d8eb221 Mon Sep 17 00:00:00 2001 From: Mathias Sander Date: Sun, 23 Jun 2024 11:20:12 +0200 Subject: [PATCH] rough fix of run number issue --- eco/bernina/bernina.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/eco/bernina/bernina.py b/eco/bernina/bernina.py index fd130b5..2c6a7c6 100644 --- a/eco/bernina/bernina.py +++ b/eco/bernina/bernina.py @@ -1305,6 +1305,7 @@ def _write_namespace_status_to_scan( f.truncate() if not statusfile.group() == statusfile.parent.group(): shutil.chown(statusfile, group=statusfile.parent.group()) + response = daq.append_aux( statusfile.resolve().as_posix(), pgroup=pgroup, @@ -1353,6 +1354,8 @@ def _write_namespace_aliases_to_scan(scan, daq=daq, force=False, **kwargs): kwargs=dict(pgroup=pgroup, run_number=runno), ) ) + #DEBUG + print(f'Sending scan_info_rel.json in {Path(aliasfile).parent.stem} to run number {runno}.') scan.remaining_tasks[-1].start() # response = daq.append_aux( # aliasfile.resolve().as_posix(), @@ -1367,6 +1370,17 @@ def _write_namespace_aliases_to_scan(scan, daq=daq, force=False, **kwargs): def _message_end_scan(scan, **kwargs): print(f"Finished run {scan.run_number}.") + if hasattr(scan, "daq_run_number"): + runno_daq_saved = scan.daq_run_number + print(f"daq_run_number is run {runno_daq_saved}.") + + try: + runno = daq.get_last_run_number() + print(f"daq last run number is run {runno}.") + except: + pass + + try: e = pyttsx3.init() e.say(f"Finished run {scan.run_number}.") @@ -1452,6 +1466,8 @@ def _copy_scan_info_to_raw(scan, daq=daq, **kwargs): kwargs=dict(pgroup=pgroup, run_number=runno), ) ) + #DEBUG + print(f'Sending scan_info_rel.json in {Path(scaninfofile).parent.stem} to run number {runno}.') scan.remaining_tasks[-1].start() # response = daq.append_aux(scaninfofile.as_posix(), pgroup=pgroup, run_number=runno) # print(f"Status: {response.json()['status']} Message: {response.json()['message']}") @@ -1523,7 +1539,9 @@ def _increment_daq_run_number(scan, daq=daq, **kwargs): for i in range(n): rn = daq.get_next_run_number() print(rn) - scan.daq_run_number = daq_run_number + scan.daq_run_number = rn + else: + scan.daq_run_number = daq_run_number except Exception as e: print(e)