ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.08k stars 3.42k forks source link

Job status are not displayed correctly in dashboard due to TimeZone #11243

Open craph opened 3 years ago

craph commented 3 years ago

Please confirm the following

Summary

Hello,

I open this issue because the job status aren't correctly displayed in the dashboard due to timezone. If a job is launch at 1AM the 13th it will be displayed for the 12th in the dashboard.

The issue occured in AWX 19.2.0 on k8s.

AWX version

19.2.0

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

Firefox, Chrome

Steps to reproduce

  1. Create a new schedule job

  2. Define the Start time to 1AM

  3. Set the local timezone to Europe/Paris image

  4. Save

In the occurences you should see something like this for Local : image

In the occurences you should see something like this for UTC : image

Expected results

In the dashboard, I want to see a point in the correct local timezone to be ISO with the Jobs output

Actual results

When the job is started, you can see the correct time of start in the Views/jobs at 1AM BUT in the Dashboard, you can see a point for the day before because of the UTC time at 11PM.

In the jobs list I can see the correct schedule time : image

But in the dashboard it's for the day before : image

As you can see I have no jobs for the 10/13 but in the jobs list you can see the 10/13/2021 at 1AM

Additional information

No response

craph commented 3 years ago

@nixocio Are you aware of this behavior ? is there someone in the AWX team that can give a point of view into this ? Thank you very much.

craph commented 3 years ago

@ryanpetrello , @AlexSCorey , Hello, I'm trying to find why the Dashboard Jobs status are not correctly showing the jobs history in the correct timezone.

I saw this and I think this is not taking Local Timezone unless the variable dateSecs contains the correct datetime of the jobs executions https://github.com/ansible/awx/blob/517f1d79913db87c06b2b20958c6893130be30a5/awx/ui/src/screens/Dashboard/DashboardGraph.js#L67

craph commented 3 years ago

@ryanpetrello Is it possible that the issue is related to that : https://github.com/ansible/awx/blob/517f1d79913db87c06b2b20958c6893130be30a5/awx/main/models/schedules.py#L126

May be when the job list are GET there is no convertion in the correct TZ ?

ryanpetrello commented 3 years ago

Hey @craph,

I'm less involved with this project than I used to be, and am no longer an active contributor. @shanemcd @AlanCoding @chrismeyersfsu ☝️

AlexSCorey commented 3 years ago

@craph thanks for reaching out to me. The UI team discussed this bug yesterday and we are tracking it. I appreciate you tagging the bit of code that may be causing the problem. Thank you for doing that!

craph commented 3 years ago

Hello @AlexSCorey , I'm trying to dig in more to find if I can help. It's really strange because the Jobs list is displayed fine but the Jobs status are not. Please could you tell me where I can find the API that return the jobs status list ? I'm not sure if I look in the right place Thank you very much.

AlexSCorey commented 3 years ago

@craph To get the status of the individual jobs we hit /dashboard/graphs/jobs I hope this helps.

craph commented 3 years ago

@craph To get the status of the individual jobs we hit /dashboard/graphs/jobs I hope this helps.

Hi @AlexSCorey I was searching the Py file behind this endpoint to try to compare it with the one for the jobs list

Nevertheless did the UI team found some clues about the root cause of this behavior ?

Another possibility, the mistake can be here (but I'm very confused because in jobs list api I'm unable to find where the TZ is used to have the correct local time in output. It seems it correctly saved in the database ): https://github.com/ansible/awx/blob/61eb99c46deaa3f31b206ba12a2858d23fa300da/awx/api/views/__init__.py#L354 and https://github.com/ansible/awx/blob/61eb99c46deaa3f31b206ba12a2858d23fa300da/awx/api/views/__init__.py#L356

I suppose element[0].timetuple() contains a naive datetime so there are not enough data to convert it in localtimezone ? Or it's something between time.mktime and element[0].timetuple()

craph commented 3 years ago

I @AlexSCorey do you have any updates on this issue ? Thank you very much. Best regards,

AlexSCorey commented 3 years ago

@craph I am not sure that anybody has had a moment to address this issue, or look any further. We are aware of it, though!

craph commented 2 years ago

Any news about this subjects ?