Treeherder client - TreeherderJob.init_data should initialize job timestamps to numeric values

RESOLVED WONTFIX

Status

Tree Management
Treeherder: Client Libraries
P3
normal
RESOLVED WONTFIX
3 years ago
8 months ago

People

(Reporter: bc, Unassigned)

Tracking

Details

(Reporter)

Description

3 years ago
https://github.com/mozilla/treeherder-client/blob/master/thclient/client.py#L275

submit_timestamp, start_timestamp and end_timestamp are initialized to an empty string. If a user creates a job collection to submit a pending job, or an update to a job without specifying all 3 timestamps, it will cause a server error:

tjc = TreeherderJobCollection();
tj = tjc.get_job()
tj.add_submit_timestamp(...)
req = TreeherderRequest(...(
response = req.post(tjc)

Server Error:

{"detail": "invalid literal for long() with base 10: 
          ''"}
Priority: -- → P2
Blocks: 1072676
Priority: P2 → P3
No longer blocks: 1072676
Component: Treeherder → Treeherder: API
Priority: P3 → P4
Component: Treeherder: API → Treeherder: Python Client

Comment 1

3 years ago
Hm, I think the url in Comment 0 was not available any more because the treeherder client on github has been closed. :)
Blocks: 1196191
Priority: P4 → P3
(In reply to MikeLing from comment #1)
> Hm, I think the url in Comment 0 was not available any more because the
> treeherder client on github has been closed. :)

The updated link is:
https://github.com/mozilla/treeherder/blob/afcb9d04eeab6b518a9557dffee1f9989c6f0036/treeherder/client/thclient/client.py#L294-L301

:-)

Comment 3

2 years ago
(In reply to Ed Morley [:emorley] from comment #2)
Hi Ed, thank you for your link! :)

Could you give me some advice about init value for those timestamps? What kind of value can be considered as a good choose for them? maybe set them as 599616000(1989, 1, 1) which is a impossible value ?
I think the best fix is to make the API not error when they those properties are not set - or else allow setting them to null or similar. The client should then not send empty strings for them.

Comment 5

2 years ago
(In reply to Ed Morley [:emorley] from comment #4)
> I think the best fix is to make the API not error when they those properties
> are not set - or else allow setting them to null or similar. 

Due to I'm not very familiar with the process of submit a job to treeherder server, could you tell me how to test(trigger) that error? Anyway, I haven't fully understand what's your meaning of 'make the API not error' because I don't know where is code of the API.(sorry)

> The client should then not send empty strings for them.

Is that mean init them to 'null' rather than ''?
Submitting jobs/pushes via the API is now discouraged in favour of using Pulse (bug 1349182), so we're wontfixing API-specific issues.
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.