Skip to content

Commit

Permalink
try except loop for xrootd errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Jul 24, 2024
1 parent 57271d8 commit 316ee18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/HHbbVV/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def get_fileset(
for subsample, fnames in sample_set.items():
fileset[sample][subsample] = len(fnames)
if max_files is not None:
print("Max files")
fileset[sample][subsample] = min(fileset[sample][subsample], max_files)

else:
Expand Down
14 changes: 13 additions & 1 deletion src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,19 @@ def run(p: processor, fileset: dict, args):
maxchunks=None if args.maxchunks == 0 else args.maxchunks,
)

out, metrics = run(fileset, "Events", processor_instance=p)
for i in range(5):
try:
out, metrics = run(fileset, "Events", processor_instance=p)
break
except OSError as e:
import time

if i < 4:
print(f"Caught OSError: {e}")
print("Retrying in 1 minute...")
time.sleep(60)
else:
raise e

with (outdir / f"{args.starti}-{args.endi}.pkl").open("wb") as f:
pickle.dump(out, f)
Expand Down

0 comments on commit 316ee18

Please sign in to comment.