Skip to content

Commit

Permalink
Add profiling to science_reduction()
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrory committed Sep 11, 2024
1 parent 5856b28 commit cb5457c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions python/lvmdrp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1920,20 +1920,21 @@ def run_drp(mjd: Union[int, str, list], expnum: Union[int, str, list] = None,
if sci_cond:
kwargs = get_config_options('reduction_steps.science_reduction')
for expnum in sci['expnum'].unique():
try:
science_reduction(expnum, use_longterm_cals=True,
fluxcal_method=fluxcal_method,
skip_2d=skip_2d,
skip_1d=skip_1d,
skip_post_1d=skip_post_1d,
clean_ancillary=clean_ancillary,
debug_mode=debug_mode, **kwargs)
except Exception as e:
log.exception(f'Failed to reduce science frame mjd {mjd} exposure {expnum}: {e}')
create_status_file(tileid, mjd, status='error')
trace = traceback.format_exc()
update_error_file(tileid, mjd, expnum, trace)
continue
with Timer(name='Science Reduction', logger=log.info):
try:
science_reduction(expnum, use_longterm_cals=True,
fluxcal_method=fluxcal_method,
skip_2d=skip_2d,
skip_1d=skip_1d,
skip_post_1d=skip_post_1d,
clean_ancillary=clean_ancillary,
debug_mode=debug_mode, **kwargs)
except Exception as e:
log.exception(f'Failed to reduce science frame mjd {mjd} exposure {expnum}: {e}')
create_status_file(tileid, mjd, status='error')
trace = traceback.format_exc()
update_error_file(tileid, mjd, expnum, trace)
continue

# create done status on successful run
if not status_file_exists(tileid, mjd, status='error'):
Expand Down

0 comments on commit cb5457c

Please sign in to comment.