Closed Bug 1174124 Opened 5 years ago Closed 5 years ago

Autoland should check job status using Treeherder

Categories

(Conduit :: Transplant, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: dminor, Assigned: dminor)

References

Details

Attachments

(1 obsolete file)

At the moment the code in Autoland to monitor jobs relies upon the buildapi. We should switch to Treeherder so we have access to job status from non-buildbot jobs.
Treeherder gets its information from Treestatus, so presumably you should be using that.
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #1)
> Treeherder gets its information from Treestatus, so presumably you should be
> using that.

We want to ignore failures in jobs that are hidden on Treeherder when deciding whether to land something. As far as I know, Treeherder is the only source of information on what jobs are hidden, so we need to use it.
Sorry, ignore me. I read this bug as tree status rather than job status.
autoland: add code for interacting with treeherder (bug 1174124) r?mdoglio

This adds some code for retrieving a resultset and determining whether or not
all jobs have completed and if the revision can be landed.
Attachment #8623649 - Flags: review?(mdoglio)
Assignee: nobody → dminor
Status: NEW → ASSIGNED
Comment on attachment 8623649 [details]
MozReview Request: autoland: add code for interacting with treeherder (bug 1174124) r?mdoglio

https://reviewboard.mozilla.org/r/11577/#review10083

::: autoland/autoland/treeherder.py:80
(Diff revision 1)
> +            job_name = result[names['job_type_name']]

If you need an identifier for a particular class of jobs you can use the signature. This is a hash of all the properties of a job as listed [here](https://github.com/mozilla/treeherder/blob/bd8836e7e43f8d3ba1d5266c17fa03c9784cf77b/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl#L50-L62)

::: autoland/autoland/treeherder.py:20
(Diff revision 1)
> +    url = '%s/project/%s/jobs?return_type=list&count=%s&result_set_id=%s' % (
> +          TREEHERDER_URL, repo, COUNT, result_set_id)
> +    r = requests.get(url)
> +    if r.status_code == 200:
> +        try:
> +            return r.json()
> +        except KeyError:
> +            pass

Please note that you are retrieving a single page of jobs. You should add some logic to retrieve the next page until there are results.

::: autoland/autoland/treeherder.py:20
(Diff revision 1)
> +    url = '%s/project/%s/jobs?return_type=list&count=%s&result_set_id=%s' % (
> +          TREEHERDER_URL, repo, COUNT, result_set_id)

Using the data parameter of requests.get would make this more readable imho
Attachment #8623649 - Flags: review?(mdoglio)
Comment on attachment 8623649 [details]
MozReview Request: autoland: add code for interacting with treeherder (bug 1174124) r?mdoglio

https://reviewboard.mozilla.org/r/11577/#review10085

Ship It!
Attachment #8623649 - Flags: review+
We have no immediate requirement for Autoland to check job status for autolanding to inbound, so I'm going to WONTFIX this.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Attachment #8623649 - Attachment is obsolete: true
Product: Tree Management → MozReview
Product: MozReview → Conduit
You need to log in before you can comment on or make changes to this bug.