Skip to content

Commit 2fd6c7e

Browse files
committed
Added more logs for investigation debug
1 parent fb17e22 commit 2fd6c7e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api_app/investigations_manager/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def set_correct_status(self, save: bool = True):
7474
running_jobs_list = jobs.exclude(
7575
status__in=Job.STATUSES.final_statuses()
7676
).values_list("pk", flat=True)
77-
if len(running_jobs_list) > 0:
77+
running_jobs_count = len(running_jobs_list)
78+
logger.info(
79+
f"{running_jobs_count} out of {self.jobs.count()} jobs are still running for investigation {self.pk}"
80+
)
81+
if running_jobs_count > 0:
7882
logger.info(
7983
f"Jobs {running_jobs_list} are still running for investigation {self.pk}"
8084
)
@@ -83,13 +87,15 @@ def set_correct_status(self, save: bool = True):
8387
break
8488
# and they are all completed
8589
else:
90+
logger.info(f"Setting investigation {self.pk} to concluded")
8691
self.status = self.STATUSES.CONCLUDED.value
8792
self.end_time = (
8893
self.jobs.order_by("-finished_analysis_time")
8994
.first()
9095
.finished_analysis_time
9196
)
9297
else:
98+
logger.info(f"Setting investigation {self.pk} to created")
9399
self.status = self.STATUSES.CREATED.value
94100
self.end_time = None
95101
if save:

0 commit comments

Comments
 (0)