Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
fix: only log error when anomaly needs to run
Browse files Browse the repository at this point in the history
`anomaly_task` will be None when anomaly doesn't need to run. We will
still log an error in that case, when there's actually no error.

Co-authored-by: Kartikay Bagla <[email protected]>
  • Loading branch information
Samyak2 and kartikay-bagla committed Jan 17, 2022
1 parent 7eb64b5 commit 917ded1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions chaos_genius/jobs/anomaly_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,12 @@ def queue_kpi_analytics(kpi_id: int, run_anomaly=True):
else:
rca_task.apply_async()

if anomaly_task is None:
logger.error(
"Not running anomaly since it is not configured or KPI "
"(%d) was not found.",
kpi_id,
)
else:
anomaly_task.apply_async()
if run_anomaly:
if anomaly_task is None:
logger.error(
"Not running anomaly since it is not configured or KPI "
"(%d) was not found.",
kpi_id,
)
else:
anomaly_task.apply_async()

0 comments on commit 917ded1

Please sign in to comment.