Skip to content

Commit

Permalink
Add extra logging to debug some missed reductions
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdaily committed Nov 4, 2024
1 parent 0c331f9 commit b2bb999
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion banzai/utils/realtime_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def need_to_process_image(file_info, context):

if 'frameid' in file_info:
if 'version_set' not in file_info:
logger.info("Version set not available in file_info", extra_tags={"filename": file_info['filename']})
return True
checksum = file_info['version_set'][0].get('md5')
filename = file_info['filename']
Expand All @@ -57,7 +58,7 @@ def need_to_process_image(file_info, context):

logger.info("Checking if file needs to be processed", extra_tags={"filename": filename})
if not (filename.endswith('.fits') or filename.endswith('.fits.fz')):
logger.debug("Filename does not have a .fits extension, stopping reduction",
logger.error("Filename does not have a .fits extension, stopping reduction",
extra_tags={"filename": filename})
return False

Expand All @@ -70,6 +71,7 @@ def need_to_process_image(file_info, context):
# Check the md5.
# Reset the number of tries if the file has changed on disk/in s3
if image.checksum != checksum:
logger.info('File has changed on disk. Resetting success flags and tries', extra_tags={'filename': filename})
need_to_process = True
image.checksum = checksum
image.tries = 0
Expand All @@ -78,6 +80,7 @@ def need_to_process_image(file_info, context):

# Check if we need to try again
elif image.tries < context.max_tries and not image.success:
logger.info('File has not been successfully processed yet. Trying again.', extra_tags={'filename': filename})
need_to_process = True
dbs.commit_processed_image(image, context.db_address)

Expand Down

0 comments on commit b2bb999

Please sign in to comment.