Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
Do not fail if we can't schedule jobs for Treeherder
Browse files Browse the repository at this point in the history
  • Loading branch information
Armen Zambrano G committed Jun 30, 2016
1 parent 696f7c2 commit 2896d9b
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions pulse_actions/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@ def start_request(repo_name, revision):
dry_run=CONFIG['dry_run'],
**CONFIG['pulse_actions_job_template']
)
JOB_FACTORY.submit_running(treeherder_job)
results['treeherder_job'] = treeherder_job
try:
JOB_FACTORY.submit_running(treeherder_job)
results['treeherder_job'] = treeherder_job
except Exception as e:
LOG.error(str(e))
LOG.warning("We will have to skip scheduling a Treeherder 'Sch' job")
# Even though the default value is None by being explicit we won't regress by mistake
results['treeherder_job'] = None

return results

Expand All @@ -256,34 +262,34 @@ def end_request(exit_code, data, log_path, treeherder_job, start_time):

if CONFIG['submit_to_treeherder']:
if treeherder_job is None:
LOG.error("We should not have an empty job if we're submitting to Treeherder")

# XXX: We will add multiple logs in the future
url = S3_UPLOADER.upload(log_path)
LOG.debug('Log uploaded to {}'.format(url))

JOB_FACTORY.submit_completed(
job=treeherder_job,
result=EXIT_CODE_JOB_RESULT_MAP[exit_code],
job_info_details_panel=[
{
"url": FILE_BUG,
"value": "bug template",
"content_type": "link",
"title": "File bug"
},
],
log_references=[
{
"url": url,
# Irrelevant name since we're not providing a custom log viewer parser
# and we're setting the status to 'parsed'
"name": "buildbot_text",
"parse_status": "parsed"
}
],
)
LOG.info("Created Treeherder 'Sch' job.")
LOG.warning("As mentioned above we did not schedule a Treeherder 'Sch' job.")
else:
# XXX: We will add multiple logs in the future
url = S3_UPLOADER.upload(log_path)
LOG.debug('Log uploaded to {}'.format(url))

JOB_FACTORY.submit_completed(
job=treeherder_job,
result=EXIT_CODE_JOB_RESULT_MAP[exit_code],
job_info_details_panel=[
{
"url": FILE_BUG,
"value": "bug template",
"content_type": "link",
"title": "File bug"
},
],
log_references=[
{
"url": url,
# Irrelevant name since we're not providing a custom log viewer parser
# and we're setting the status to 'parsed'
"name": "buildbot_text",
"parse_status": "parsed"
}
],
)
LOG.info("Created Treeherder 'Sch' job.")

LOG.info('#### End of request ####.')
end_logging(log_path)
Expand Down

0 comments on commit 2896d9b

Please sign in to comment.