Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add try except to catch det_match failures #1077

Merged
merged 17 commits into from
Jan 3, 2025
Merged

Conversation

mmccrackan
Copy link
Contributor

Adds some error checking around preprocess_utils.get_groups to catch failures related to getting det info.

@mmccrackan mmccrackan requested a review from msilvafe December 20, 2024 17:42
@msilvafe msilvafe marked this pull request as ready for review January 3, 2025 15:31
@msilvafe
Copy link
Contributor

msilvafe commented Jan 3, 2025

Need to incorporate updates to file cleanup in the demod mapmaking functions.

Copy link
Contributor

@msilvafe msilvafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this update and the associated testing. Added a couple inline comments but also approved.

Comment on lines 304 to 305
policy_dir_init = os.path.dirname(configs_init['archive']['policy']['filename']) + '/temp/'
policy_dir_proc = os.path.dirname(configs_proc['archive']['policy']['filename']) + '/temp_proc/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use os.path.join() instead of + str

Comment on lines 308 to 321
if os.path.exists(policy_dir_init):
found = False
for f in os.listdir(policy_dir_init):
if obs_id in f:
found = True
break

if found:
error = pp_util.save_group_and_cleanup(obs_id, configs_init, context_init,
subdir='temp', remove=overwrite)
if error is not None:
f = open(errlog, 'a')
f.write(f'\n{time.time()}, cleanup error\n{error[0]}\n{error[2]}\n')
f.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this whole block be a single function that takes in policy_dir, obs_id, config, context, subdir, remove, and errlog so we can just call that line twice here (and in other places where its needed i.e. preprocess_tod, demod mapmaker)

obs_id = obs['obs_id']
pp_util.save_group_and_cleanup(obs_id, configs, context,
subdir='temp', remove=overwrite)
policy_dir = os.path.dirname(configs['archive']['policy']['filename']) + '/temp/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

join

@mmccrackan mmccrackan merged commit 86d99c2 into master Jan 3, 2025
3 checks passed
chervias added a commit that referenced this pull request Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants