Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Bug 1358827 - Autophone - raise fatal errors when test job_guid is in…
Browse files Browse the repository at this point in the history
…valid, r=jmaher.
  • Loading branch information
bclary committed Apr 26, 2017
1 parent 9703f5e commit 2d67335
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions autophonetreeherder.py
Expand Up @@ -154,6 +154,16 @@ def _create_job(self, tjc, machine, build_url, project, revision, build_type, bu

LOGGER.info('creating Treeherder job %s for %s %s, revision: %s',
t.job_guid, t.name, project, revision)
if not t.job_guid:
LOGGER.error(
'_create_job: invalid job_guid %s for test %s, '
'machine: %s, build_url: %s, project: %s, revision: %s, '
'build_type: %s, build_abi: %s, build_platform: %s, '
'build_sdk: %s, builder_type: %s',
t.name, t.job_guid, machine, build_url, project,
revision, build_type, build_abi, build_platform,
build_sdk, builder_type)
raise Exception('Can not create Treeherder Job with invalid test job_guid')

LOGGER.debug('AutophoneTreeherder.create_job: test config_file=%s, config sections=%s',
t.config_file, t.cfg.sections())
Expand Down
10 changes: 10 additions & 0 deletions jobs.py
Expand Up @@ -204,6 +204,13 @@ def new_job(self, build_url, build_id=None, build_type=None, build_abi=None,
continue
new_tests.append(test)
test.generate_guid()
if not test.job_guid:
LOGGER.error(
'jobs.new_job: invalid job_guid: %s, device: %s, '
'name: %s, config_file: %s, chunk: %s, repos: %s',
build_url, device, test.name, test.config_file,
test.chunk, repos)
raise Exception('Can not insert test with invalid job_guid')
self._execute_sql(
conn,
'insert into tests values (?, ?, ?, ?, ?, ?, ?)',
Expand Down Expand Up @@ -329,6 +336,9 @@ def get_next_job(self, lifo=False, device=None, worker=None):
test.config_file == test_row['config_file'] and \
test.chunk == test_row['chunk'] and \
test.repos == test_row['repos']:
if not test_row['guid']:
LOGGER.error('jobs.get_next_job: invalid job_guid: %s', job)
raise Exception('Found test with invalid job_guid')
test.job_guid = test_row['guid']
job['tests'].append(test)
LOGGER.debug('jobs.get_next_job: %s', job)
Expand Down

0 comments on commit 2d67335

Please sign in to comment.