From d2be78b24484291b751a35438c1d9b0c7889a32f Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Thu, 27 Feb 2025 13:48:50 +0100 Subject: [PATCH] No longer recorrect files when output files seem to still be around --- webservice/webservice.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/webservice/webservice.py b/webservice/webservice.py index 2437b0783..eb539d951 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -1243,17 +1243,33 @@ class ActionsServer: try: prior_request_time = calmeta["runtime-summary"]\ ["pipeline-steps"]["request-time"] - karabo_id = calmeta["calibration-configurations"]["karabo-id"] + + calargs = calmeta["calibration-configurations"] + karabo_id = calargs["karabo-id"] + karabo_das = {da.split('/')[0] for da in calargs["karabo-da"]} + out_path = Path(calargs["out-folder"]) except KeyError: logging.warning("Did not find expected metadata in %s", calmeta_pth, exc_info=True) + continue + + for karabo_da in karabo_das: + try: + next(out_path.glob(f"*-R*-{karabo_da}-S*.h5")) + except (StopIteration, IndexError): + pass + else: + logging.info(f"Found {karabo_da} output files for " + f"{karabo_id}, skipping correction re-run") + break + else: mddirs_by_krb_id.setdefault(karabo_id, []).append( - (calmeta_pth.parent, prior_request_time) - ) + (calmeta_pth.parent, prior_request_time)) logging.info("Found %d corrections to re-run for p%s r%s: %s", - len(mddirs_by_krb_id), proposal, runnr, list(mddirs_by_krb_id)) + len(mddirs_by_krb_id), proposal, runnr, + list(mddirs_by_krb_id)) except Exception as e: msg = Errors.JOB_LAUNCH_FAILED.format('correct', e) -- GitLab