Timing of Job event list availability after Job notification sent

Our scenario:

  1. After the job finishes successful, receive a job successful notification
  2. invoke AWX API of http://<awx url>/api/v2/jobs/<Job id>/job_events/?task=<the task name to match>

So step 2 usually return 3 results in the result array with 3 different types of events:

  • event: playbook_on_task_start
  • event: runner_on_ok
  • event: runner_on_start

We are only interested in runner_on_ok event in which the event_data contains res β†’ msg (the output of the <the task name to match> task in the awx job events list url mentioned above in step 2)

However we have seen that if we invoke 2) too soon after 1), it may not return the runner_on_ok event.

The pattern we have seen whether it return the runner_on_ok depends on the timing of 2) vs the modified timestamp of that runner_on_ok event:
A. If we invoke the API before the modified timestamp, it will not be included
B. If we invoke the API after the modified timestamp, it will be included

(for A, if we invoke the API later we will eventually get the runner_on_ok event and then can fetch the modified timestamp to compare with when the API is invoked)

Can you confirm this behavior?

AWX version: 23.0.0

@chrismeyersfsu: yes, this is the correct behavior

you can try to wait for event_processing_finished for the specific job

1 Like

Thank you, this article further explains it: