Skip to content

Commit 1bd760d

Browse files
committed
Add a check whether a run is already present in the ZODB database before parsing it.
1 parent d059b4d commit 1bd760d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/nectarchain/user_scripts/jlenain/parse_dqm_fits_file.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
help="process a specific run.",
3535
type=str,
3636
)
37+
parser.add_argument(
38+
"-f",
39+
"--force",
40+
default=False,
41+
action="store_true",
42+
help="if this run is already in the DB, force re-parsing its DQM output again.",
43+
)
3744
parser.add_argument(
3845
"-p",
3946
"--path",
@@ -47,6 +54,14 @@
4754
logger.critical("A run number should be provided.")
4855
sys.exit(1)
4956

57+
db = DQMDB(read_only=True)
58+
if not args.force and f"NectarCAM_Run{args.run}" in list(db.root.keys()):
59+
logger.warning(
60+
f'The run {args.run} is already present in the DB, will not parse this DQM run, or consider forcing it with the "--force" option.'
61+
)
62+
sys.exit(0)
63+
del db
64+
5065
lfn = f"{args.path}/NectarCAM_DQM_Run{args.run}.tar.gz"
5166

5267
if not os.path.exists(os.path.basename(lfn)):

0 commit comments

Comments
 (0)