[autotest] Suite scheduler files bugs for exceptions raised in create_suite_job
This CL is to make suite scheduler file bugs using our bug filer for
several types of exceptions raised by create_suite_job. The exceptions are:
- ControlFileNotFound
- NoControlFileList
- ControlFileEmpty
- ControlFileMalformed
To enable bug filing, use '-b' option of suite_scheduler.py
Bug will be assgined to Lab sheriff.
This CL changes the private method _create_bug_report to public in
server/cros/dynamic_suite/reporting.py, so that we can file a general
bug that is not a test failure. After crbug.com/254256 is fixed,
the bug filing logic in deduping_scheduler.py should be modified.
This CL also moves ParseBuildName() from base_event.py to site_utils,
to avoid import loop. Callers of this methods are updated.
BUG=chromium:242569
TEST=deduping_scheduler_unittest.py;driver_unittest.py;base_event_unittest.py;
ran on chromeos-lab1.hot and confirm bug are properly filed.
DEPLOY=suite_scheduler
Change-Id: Ia57a2e625b7b39dcfe51892c208613c927f3a54e
Reviewed-on: https://gerrit.chromium.org/gerrit/60158
Commit-Queue: Fang Deng <fdeng@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Fang Deng <fdeng@chromium.org>
diff --git a/server/site_utils.py b/server/site_utils.py
index 8e9010f..6b27970 100644
--- a/server/site_utils.py
+++ b/server/site_utils.py
@@ -12,6 +12,8 @@
_SHERIFF_JS = global_config.global_config.get_config_value(
'NOTIFICATIONS', 'sheriffs', default='')
+_LAB_SHERIFF_JS = global_config.global_config.get_config_value(
+ 'NOTIFICATIONS', 'lab_sheriffs', default='')
_CHROMIUM_BUILD_URL = global_config.global_config.get_config_value(
'NOTIFICATIONS', 'chromium_build_url', default='')
@@ -64,18 +66,23 @@
return get_label_from_afe(hostname, constants.VERSION_PREFIX, afe)
-def get_sheriffs():
+def get_sheriffs(lab_only=False):
"""
Polls the javascript file that holds the identity of the sheriff and
parses it's output to return a list of chromium sheriff email addresses.
The javascript file can contain the ldap of more than one sheriff, eg:
document.write('sheriff_one, sheriff_two').
- @return: A list of chroium.org sheriff email addresses to cc on the bug
- if the suite that failed was the bvt suite. An empty list otherwise.
+ @param lab_only: if True, only pulls lab sheriff.
+ @return: A list of chroium.org sheriff email addresses to cc on the bug.
+ An empty list if failed to parse the javascript.
"""
sheriff_ids = []
- for sheriff_js in _SHERIFF_JS.split(','):
+ sheriff_js_list = _LAB_SHERIFF_JS.split(',')
+ if not lab_only:
+ sheriff_js_list.extend(_SHERIFF_JS.split(','))
+
+ for sheriff_js in sheriff_js_list:
try:
url_content = base_utils.urlopen('%s%s'% (
_CHROMIUM_BUILD_URL, sheriff_js)).read()