Skip to content

Commit

Permalink
[feat] Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Nov 13, 2023
1 parent 97062e7 commit 289170d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion collect_coordinator/job_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ async def __schedule_next(self) -> None:
for job, future in to_schedule:
log.info(f"Scheduling job {job.name}")
await self.__schedule_job_unsafe(job, future)
log.info(f"Scheduled {split_at} jobs. running={len(self.running_jobs)} queued={len(self.job_queue)}")

@timed("collect_coordinator", "schedule_job")
async def __schedule_job_unsafe(self, definition: JobDefinition, result: Future[bool]) -> JobReference:
Expand Down Expand Up @@ -324,11 +325,12 @@ async def __watch_jobs(self) -> None:
label_selector=f"app=collect-coordinator,coordinator-id={self.coordinator_id}",
):
try:
log.info(f"Job changed: {event}")
change_type = event["type"] # ADDED, MODIFIED, DELETED
job = event["object"]
name = job.metadata.name
ref = JobReference.from_job(job)
job_id = job.metadata.annotations.get("job-id", "n/a")
log.info(f"Job changed: id={job_id}, name={name}, type={change_type}, status={ref.status}")
async with self.running_jobs_lock:
does_not_exist = name not in self.running_jobs
running_job = self.__running_job_unsafe(job)
Expand Down

0 comments on commit 289170d

Please sign in to comment.