Skip to content

Commit

Permalink
[chore] Better logging (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias authored May 22, 2024
1 parent 4e6dc08 commit 6d83b5b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions collect_coordinator/worker_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def __init__(

@timed(module="collect_coordinator", name="collect")
async def collect(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -> bool:
log.debug(f"Collect function called with ctx: {ctx}, args: {args}, kwargs: {kwargs}")
# TODO: switch to debug here
log.info(f"Collect function called with ctx: {ctx}, args: {args}, kwargs: {kwargs}")
job_id: str = ctx["job_id"]
if len(args) == 1 and isinstance(args[0], dict):
data = args[0]
Expand All @@ -74,10 +75,14 @@ async def collect(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -> bool:
message = f"Failed to parse collect definition json: {e}"
log.error(message, exc_info=True)
raise ValueError(message) from e
log.info(f"Received collect job {jd.name}")
future = await self.coordinator.start_job(jd)
log.info(f"Collect job {jd.name} started. Wait for the job to finish.")
return await future
try:
log.info(f"Received collect job {jd.name}")
future = await self.coordinator.start_job(jd)
log.info(f"Collect job {jd.name} started. Wait for the job to finish.")
return await future
except Exception as e:
log.warning(f"Collect job {jd.name} failed: {e}", exc_info=True)
raise
else:
message = f"Invalid arguments for collect function. Got {args}. Expect one arg of type Json."
log.error(message)
Expand Down

0 comments on commit 6d83b5b

Please sign in to comment.