Skip to content

Commit

Permalink
Added more logging (#2417)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbahrai authored Jan 16, 2025
1 parent c055cda commit 259f7d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/celery/reporting_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ def create_nightly_notification_status(day_start=None):
else:
# When calling the task its a string in the format of "YYYY-MM-DD"
day_start = datetime.strptime(day_start, "%Y-%m-%d").date()
current_app.logger.info("create-nightly-notification-status started for {} ".format(day_start))
for i in range(0, 4):
process_day = day_start - timedelta(days=i)

current_app.logger.info(
"create-nightly-notification-status-for-day called from higher level job for day {} ".format(process_day)
)
create_nightly_notification_status_for_day.apply_async(
kwargs={"process_day": process_day.isoformat()}, queue=QueueNames.REPORTING
)
Expand All @@ -94,6 +97,7 @@ def create_nightly_notification_status_for_day(process_day):
service_ids = [x.id for x in Service.query.all()]
chunk_size = 10
iter_service_ids = iter(service_ids)
current_app.logger.info("create-nightly-notification-status-for-day STARTED for day {} ".format(process_day))

while True:
chunk = list(islice(iter_service_ids, chunk_size))
Expand Down
4 changes: 2 additions & 2 deletions app/dao/fact_notification_status_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def update_fact_notification_status(data, process_day, service_ids=None):

except IntegrityError as e:
db.session.rollback()
current_app.logger.error(f"Integrity error in update_fact_notification_status: {e}")
current_app.logger.info(f"Integrity error in update_fact_notification_status: {e}")
raise
except Exception as e:
db.session.rollback()
current_app.logger.error(f"Unexpected error in update_fact_notification_status: {e}")
current_app.logger.info(f"Unexpected error in update_fact_notification_status: {e}")
raise


Expand Down

0 comments on commit 259f7d2

Please sign in to comment.