Skip to content

Commit

Permalink
#6022 - retry beamline animation reads
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeilman committed Aug 1, 2023
1 parent 01ad5a3 commit 648eba6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion sirepo/package_data/template/srw/parameters.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ def _process_watch(filename, report):
d, x_range, y_range = _resize_report(report, d, x_range, y_range)
if report.get("rotateAngle", 0):
d, x_range, y_range = _rotate_report(report, d, x_range, y_range, info)
print(f"Size before: {len(data)} after: {d.size} Dimensions: {d.shape}, Resize: [{y_range}, {x_range}]")
new_mesh = srwlib.SRWLRadMesh(
_eStart=mesh.eStart,
_eFin=mesh.eFin,
Expand Down
19 changes: 9 additions & 10 deletions sirepo/template/srw.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,16 +512,15 @@ def sim_frame(frame_args):
else:
frame_args.sim_in.report = "initialIntensityReport"
frame_args.sim_in.models.initialIntensityReport = m
if "beamlineAnimation" not in r:
# some reports may be written at the same time as the reader
# if the file is invalid, wait a bit and try again
for i in (1, 2, 3):
try:
return extract_report_data(frame_args.sim_in)
except Exception:
# sleep and retry to work-around concurrent file read/write
pkdlog("sleep and retry simulation frame read: {} {}", i, r)
time.sleep(2)
# some reports may be written at the same time as the reader
# if the file is invalid, wait a bit and try again
for i in (1, 2, 3):
try:
return extract_report_data(frame_args.sim_in)
except Exception:
# sleep and retry to work-around concurrent file read/write
pkdlog("sleep and retry simulation frame read: {} {}", i, r)
time.sleep(2)
return extract_report_data(frame_args.sim_in)


Expand Down

0 comments on commit 648eba6

Please sign in to comment.