# Timing of Job event list availability after Job notification sent

**URL:** <https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [April 2, 2024, 5:54pm UTC](https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686 "2024-04-02T17:54:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhzs8](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@yhzs8](https://forum.ansible.com/u/yhzs8)\
**Post date:** [April 2, 2024, 5:54pm UTC](https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686/1 "2024-04-02T17:54:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheRealHaoLiu](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/therealhaoliu/32/100_2.png) [@TheRealHaoLiu](https://forum.ansible.com/u/TheRealHaoLiu)\
**Post date:** [April 3, 2024, 6:50pm UTC](https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686/2 "2024-04-03T18:50:38Z")

</div>

@chrismeyersfsu: yes, this is the correct behavior

you can try to wait for `event_processing_finished` for the specific job

---

<div class="post-metadata">

**Author:** ![yhzs8](https://avatars.discourse-cdn.com/v4/letter/y/71c47a/32.png) [@yhzs8](https://forum.ansible.com/u/yhzs8)\
**Post date:** [April 4, 2024, 6:34pm UTC](https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686/3 "2024-04-04T18:34:39Z")

</div>

Thank you, this article further explains it:  
[https://rayperrydev.medium.com/ansible-awx-logs-and-the-event-processing-finished-flag-33e0e1d7b04c](https://rayperrydev.medium.com/ansible-awx-logs-and-the-event-processing-finished-flag-33e0e1d7b04c)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 4, 2024, 6:34pm UTC](https://forum.ansible.com/t/timing-of-job-event-list-availability-after-job-notification-sent/4686/4 "2024-05-04T18:34:52Z")

</div>

Closed on May 4, 2024, 6:34pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
