Skip to content

Commit

Permalink
If we can't retrigger a job let's schedule it as a new job
Browse files Browse the repository at this point in the history
  • Loading branch information
Armen Zambrano G committed Jul 13, 2016
1 parent 0fb3576 commit 6726bae
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions mozci/mozci.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,20 +517,28 @@ def trigger_range(buildername, revisions, times=1, dry_run=False,
LOG.info("We have found %d potential job(s) matching '%s' on %s. "
"We need to trigger more." % (status_summary.potential_jobs, buildername, rev))

schedule_new_job = False
# If a job matching what we want already exists, we can
# use the retrigger API in self-serve to retrigger that
# instead of creating a new arbitrary job
if len(matching_jobs) > 0 and files is None:
request_id = QUERY_SOURCE.get_buildapi_request_id(repo_name, matching_jobs[0])
make_retrigger_request(
repo_name=repo_name,
request_id=request_id,
auth=get_credentials(),
count=(times - status_summary.potential_jobs),
dry_run=dry_run)
try:
request_id = QUERY_SOURCE.get_buildapi_request_id(repo_name, matching_jobs[0])
make_retrigger_request(
repo_name=repo_name,
request_id=request_id,
auth=get_credentials(),
count=(times - status_summary.potential_jobs),
dry_run=dry_run)
except Exception as e:
LOG.exception(e)
LOG.warning(
"We failed to retrigger the job, however, we're going to try differently."
)
schedule_new_job = True

# If no matching job exists, we have to trigger a new arbitrary job
else:
if schedule_new_job:
list_of_requests = trigger_job(
revision=rev,
buildername=buildername,
Expand Down

0 comments on commit 6726bae

Please sign in to comment.