Skip to content

Commit

Permalink
Check if processed data already exists in --production mode (#1024)
Browse files Browse the repository at this point in the history
* Add check if live_data exists, assuming live_data first type

* Check now for bootstrax_state instead. Not sure about the 'else' in l.362.

* Removed 'else' statement

* Update bin/bootstrax -> typos

Co-authored-by: Joran R. Angevaare <jorana@nikhef.nl>

* Change 'processing' to 'busy' in possible bootstrax_states

Co-authored-by: Joran R. Angevaare <jorana@nikhef.nl>

Co-authored-by: Joran R. Angevaare <jorana@nikhef.nl>
  • Loading branch information
mflierm and JoranAngevaare committed May 16, 2022
1 parent 55f1a43 commit a13f6cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/bootstrax
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,23 @@ def main():
elif args.process:
t_start = now()
number = args.process

# Check whether the run is already processed
bootstrax_state = run_coll.find_one(
{'number': number},
projection={'bootstrax': True}).get('bootstrax', {}
).get('state', 'no-state')
if args.production and bootstrax_state in ['done', 'busy', 'considering']:
message = f"It looks like run {number} is already processed."
log_warning(message, priority='fatal')
raise ValueError(message)

rd = consider_run({'number': number})
if rd is None:
message = f"Trying to process single run but no run numbered {number} exists"
log_warning(message, priority='fatal')
raise ValueError(message)

set_state('busy')
process_run(rd)
log.info(
Expand Down

0 comments on commit a13f6cf

Please sign in to comment.