From b8b78387f8d1a25d205fe38068d63147ca139468 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Tue, 9 Jan 2024 11:19:19 +0000 Subject: [PATCH] Expand run folder to 4 digits in report backfill script --- webservice/add_reports.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webservice/add_reports.py b/webservice/add_reports.py index 96044fd31..5dafdda74 100644 --- a/webservice/add_reports.py +++ b/webservice/add_reports.py @@ -1,6 +1,7 @@ """Backfill reports to myMdC from job databases before we started injecting them""" import argparse import os.path +import re import shlex import sys import sqlite3 @@ -36,6 +37,11 @@ for i, r in enumerate(rows): print("Couldn't find report path in %r", cmd_args) continue + # Workaround: we retrospectively renamed folders like 'r67' to 'r0067'. + def runnr_sub(m: re.Match): + return f'/r{m[1].zfill(4)}/' + report_path = re.sub(r'/r(\d{1,3})/', runnr_sub, report_path, count=1) + if not os.path.isfile(report_path): print(f"Report file {report_path} missing (p{r['proposal']}, r{r['run']})") continue -- GitLab