Skip to content

Commit

Permalink
feat(engine): Add logging when run status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt committed Mar 24, 2024
1 parent 41ad4d3 commit fa32bb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tracecat/runner/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ async def run_action(
# TODO: Move these calls into a logger
async def log_create_action_run(action_run: ActionRun) -> ActionRunResponse:
"""Create a workflow run."""
logger.info(f"Log create action run {action_run.id}")
action_id = action_key_to_id(action_run.action_key)
params = CreateActionRunParams(
action_run_id=action_run.id,
Expand All @@ -896,6 +897,7 @@ async def log_create_action_run(action_run: ActionRun) -> ActionRunResponse:

async def log_update_action_run(action_run: ActionRun, *, status: RunStatus) -> None:
"""Update a workflow run."""
logger.info(f"Log update action run {action_run.id} with status {status}.")
action_id = action_key_to_id(action_run.action_key)
params = UpdateActionRunParams(status=status)
async with AuthenticatedAPIClient(http2=True) as client:
Expand Down
1 change: 1 addition & 0 deletions tracecat/runner/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ async def run_workflow(
for running_task in running_jobs_store.values():
running_task.cancel()

# TODO: Update this to update with status 'failure' if any action fails
await update_workflow_run(
workflow_id=workflow_id, workflow_run_id=workflow_run_id, status=run_status
)
1 change: 1 addition & 0 deletions tracecat/runner/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ async def update_workflow_run(
status: RunStatus,
) -> None:
"""Update a workflow run."""
logger.info(f"Log update workflow run {workflow_run_id} with status {status}")
params = UpdateWorkflowRunParams(status=status)
async with AuthenticatedAPIClient(http2=True) as client:
response = await client.post(
Expand Down

0 comments on commit fa32bb8

Please sign in to comment.