Closed
Bug 1281412
Opened 9 years ago
Closed 9 years ago
Taskcluster uses wrong timestamps (+8h drift) when submitting job information to Treeherder
Categories
(Tree Management :: Treeherder: Data Ingestion, defect)
Tree Management
Treeherder: Data Ingestion
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: whimboo, Assigned: camd)
References
Details
Attachments
(1 file)
The following task has been created on TC via the API around 8:08am UTC. The results on Treeherder show a timestamp of 18:08 local time. This is a time drift of about 8h to my MEZ timezone (UTC+2).
Treeherder result:
https://treeherder.allizom.org/#/jobs?repo=mozilla-aurora&revision=23c56144e51c56304df9620bb18fb8786e087e40&filter-tier=3&filter-searchStr=tc-fxfn&selectedJob=2618464
Task (run 0):
https://tools.taskcluster.net/task-inspector/#HqACx9MmRc6bQXawCo2cJw/0
When you check the live log on Taskcluster you can see that the time is correct.
Reporter | ||
Comment 1•9 years ago
|
||
Here the job details on Treeherder:
https://treeherder.allizom.org/api/project/mozilla-aurora/jobs/2618464/
"submit_timestamp": 1466611698 => Wed, 22 Jun 2016 16:08:18 GMT
Comment 2•9 years ago
|
||
Looks like it is getting set here:
https://github.com/taskcluster/mozilla-taskcluster/blob/156c6a1d360cf13900dd53f0320a54e30ccb0d56/src/treeherder/job_handler.js#L190
Comment 3•9 years ago
|
||
So, strangely, some jobs seem to set the date correctly, and some don't.
I'm wondering if we have two components that potentially submit data to treeherder: both mozilla-taskcluster and taskcluster-treeherder. If this was the case, it could explain why some jobs submit timestamps correctly (e.g. jobs that are a result of an hg push) and others might not.
Based on this hunch, I'm going to see if I can find where taskcluster-treeherder submits job data...
Comment 4•9 years ago
|
||
So it looks like in taskcluster-treeherder, we publish messages to a pulse exchange, and there is even a json schema, yay.
I see we are setting a timestamp e.g. here in the published message:
https://github.com/taskcluster/taskcluster-treeherder/blob/f82fa25f3145eaaa0bdd15d8987017864f09b7ba/src/handler.js#L207
I suspect this may be a problem on the treeherder side, ingesting the message. However we can easily validate this by listening on the exchange to see what is in the message body.
Comment 5•9 years ago
|
||
So digging deeper, I found we are publishing to one of our own exchanges,
exchange/taskcluster-treeherder/v1/jobs
which is not yet added to https://wiki.mozilla.org/Auto-tools/Projects/Pulse/Exchanges#Treeherder
There is an exchange api reference (although not registered yet in http://references.taskcluster.net/manifest.json):
http://references.taskcluster.net/taskcluster-treeherder/v1/exchanges.json
and in turn, a message body schema:
http://schemas.taskcluster.net/taskcluster-treeherder/v1/pulse-job.json
Comment 6•9 years ago
|
||
While there is a schema published, these exchanges are not used for consuming jobs and publishing to treeherder production. Things are stabilizing and can be consumed soon, but not yet. Treeherder staging is consuming from this exchange currently as we work out some details.
Comment 7•9 years ago
|
||
The wiki has been updated to include this exchange, but beware, it's still experimental until fully used in production.
I see that manifest.json has been updated, but shouldn't it be TreeherderEvents for exchanges.json similar to the other services?
Comment 8•9 years ago
|
||
I just noticed in the bug description that the link is for a treeeherder staging instance and that is *only* consuming from the pulse exchange at exchange/taskcluster-treeherder-staging/v1/jobs
As an example, here are timestamps from a pulse message when f2IvrHifSiurj7Gc4EsQyw completed:
timeScheduled:2016-06-22T12:29:26.481Z
timeStarted:2016-06-22T13:28:54.157Z
timeCompleted:2016-06-22T13:56:29.150Z
And here is the treeherder job info that was stored:
https://treeherder.allizom.org/api/project/mozilla-inbound/jobs/27723062/
Taking a look at the completed timestamp treeherder stored, it translates to 21:56 UTC instead (8 hour drift)
>>> datetime.utcfromtimestamp(1466632589).isoformat()
'2016-06-22T21:56:29'
Comment 9•9 years ago
|
||
(In reply to Greg Arndt [:garndt] from comment #7)
> I see that manifest.json has been updated, but shouldn't it be
> TreeherderEvents for exchanges.json similar to the other services?
Whoops, fixed now! Thanks for highlighting that!
Comment 10•9 years ago
|
||
From comment 8, looks like this is a treeherder bug interpreting RFC3339 dates from the exchange/taskcluster-treeherder-staging/v1/jobs exchange. Section 2 of the RFC defines 'Z' as meaning UTC, but it looks like this timezone information is not interpreted.
Component: Platform and Services → Treeherder: Data Ingestion
Product: Taskcluster → Tree Management
Version: unspecified → ---
Comment 11•9 years ago
|
||
Thank you for the diagnosis above! :-)
Assignee | ||
Comment 12•9 years ago
|
||
Yep, this is definitely my bug. I was using a string to timestamp function that always assumed local time. Testing my fix now...
Assignee: nobody → cdawson
Flags: needinfo?(cdawson)
Comment 13•9 years ago
|
||
Assignee | ||
Comment 14•9 years ago
|
||
Comment on attachment 8765661 [details] [review]
[treeherder] mozilla:pulse-timezone-fix > mozilla:master
Awesome sleuthing to find sus this one out. Thanks so much for doing that!
I've tested this locally and it works well. I'll test on stage tomorrow.
Attachment #8765661 -
Flags: review?(emorley)
Comment 15•9 years ago
|
||
Comment on attachment 8765661 [details] [review]
[treeherder] mozilla:pulse-timezone-fix > mozilla:master
r+ but I think we really should change the Pulse schema to use unix timestamps instead.
Attachment #8765661 -
Flags: review?(emorley) → review+
Comment 16•9 years ago
|
||
Commit pushed to master at https://github.com/mozilla/treeherder
https://github.com/mozilla/treeherder/commit/3aea1cb3e094da465d0fac3640527ff932168a79
Bug 1281412 - Fix timezones with pulse ingestion (#1619)
The pulse ingestion was throwing away the UTC timezone
that came from Task Cluster and applying the local
timezone. That's how ``time.mktime`` works. Now we
parse the time, get the time tuple in UTC and create
the timextamp with ``calendar.timegm`` which expects UTC
times.
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•