diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2019-09-19 16:53:50 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2019-09-19 16:53:50 +0800 |
commit | 13c67a88c4ceb489ee0e22e95b9512b7c80a3cd5 (patch) | |
tree | 7dacca3b63e7aa2523ecabd58333d181b6a0214f /lkft | |
parent | bd0b922b4163134b5f756379c407e2a5cea1e535 (diff) |
lkft: deal with cases that job not submitted to lava yet
in that case, many of the job attributes are None
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'lkft')
-rw-r--r-- | lkft/lkft_config.py | 2 | ||||
-rw-r--r-- | lkft/views.py | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lkft/lkft_config.py b/lkft/lkft_config.py index f577998..b905680 100644 --- a/lkft/lkft_config.py +++ b/lkft/lkft_config.py @@ -11,6 +11,8 @@ citrigger_lkft = { 'mainline-9.0-hikey960-auto': 'lkft-android-9.0-mainline-hikey960', 'mainline-9.0-x15': 'lkft-android-9.0-mainline-x15', 'mainline-9.0-x15-auto': 'lkft-android-9.0-mainline-x15', + + 'mainline-gki-aosp-master-hikey': 'lkft-hikey-aosp-master-mainline-gki', }, # configs for 4.19 kernels diff --git a/lkft/views.py b/lkft/views.py index dc519a8..db565a8 100644 --- a/lkft/views.py +++ b/lkft/views.py @@ -51,6 +51,8 @@ bugzilla_instance = bugzilla.Bugzilla(url=bugzilla_api_url, api_key=BUGZILLA_API bugzilla_show_bug_prefix = 'https://%s/show_bug.cgi?id=' % bugzilla_host_name def find_lava_config(job_url): + if job_url is None: + return None for nick, config in LAVA_SERVERS.items(): if job_url.find('://%s/' % config.get('hostname')) >= 0: return config @@ -66,7 +68,7 @@ def get_attachment_urls(jobs=[]): if not lava_config : lava_config = find_lava_config(job.get('external_url')) if not lava_config: - logger.error('lava server is not found for job: %s' % job.get('external_url')) + logger.error('lava server is not found for job: %s' % job.get('url')) return None else: job['lava_config'] = lava_config @@ -98,6 +100,8 @@ def extract_save_result(tar_path, result_zip_path): def get_result_file_path(job=None): + if not job.get('lava_config'): + return None lava_nick = job.get('lava_config').get('nick') job_id = job.get('job_id') result_file_path = os.path.join(DIR_ATTACHMENTS, "%s-%s.zip" % (lava_nick, job_id)) @@ -107,10 +111,16 @@ def download_attachments_save_result(jobs=[]): # https://lkft.validation.linaro.org/scheduler/job/566144 get_attachment_urls(jobs=jobs) for job in jobs: + if not job.get('lava_config'): + continue + lava_nick = job.get('lava_config').get('nick') job_id = job.get('job_id') job_url = job.get('external_url') result_file_path = get_result_file_path(job) + if not result_file_path: + logger.info("Skip to get the attachment as the result_file_path is not found: %s %s" % (job_url, job.get('url'))) + continue if not os.path.exists(result_file_path): if job.get('job_status') != 'Complete': logger.info("Skip to get the attachment as the job is not Complete: %s %s" % (job_url, job.get('name'))) @@ -327,7 +337,7 @@ def list_builds(request): modules_done = 0 result_file_path = get_result_file_path(job=job) - if os.path.exists(result_file_path): + if result_file_path and os.path.exists(result_file_path): with zipfile.ZipFile(result_file_path, 'r') as f_zip_fd: try: root = ET.fromstring(f_zip_fd.read(TEST_RESULT_XML_NAME)) @@ -420,7 +430,7 @@ def list_jobs(request): if job.get('parent_job'): resubmitted_job_urls.append(job.get('parent_job')) result_file_path = get_result_file_path(job=job) - if not os.path.exists(result_file_path): + if not result_file_path or not os.path.exists(result_file_path): continue if project_kernel_version is None: # for project aosp-master-tracking @@ -687,6 +697,9 @@ def file_bug(request): for qa_job in qa_jobs: lava_job_id = qa_job.get('job_id') lava_url = qa_job.get('external_url') + if not lava_url: + logger.error('Job seems not submitted yet: '% job.get('url')) + continue lava_config = find_lava_config(lava_url) result_file_path = get_result_file_path(qa_job) |