Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 53 additions & 38 deletions sktm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,44 +349,59 @@ def check_patchwork(self):
series.get_patch_url_list())

def check_pending(self):
for (pjt, bid, cpw) in self.pj:
if self.jk.is_build_complete(self.jobname, bid):
logging.info("job completed: jjid=%d; type=%d", bid, pjt)
self.pj.remove((pjt, bid, cpw))
if pjt == sktm.jtype.BASELINE:
self.db.update_baseline(
self.baserepo,
self.jk.get_base_hash(self.jobname, bid),
self.jk.get_base_commitdate(self.jobname, bid),
self.jk.get_result(self.jobname, bid),
bid
)
elif pjt == sktm.jtype.PATCHWORK:
patches = list()
bres = self.jk.get_result(self.jobname, bid)
rurl = self.jk.get_result_url(self.jobname, bid)
logging.info("result=%s", bres)
logging.info("url=%s", rurl)
basehash = self.jk.get_base_hash(self.jobname, bid)
logging.info("basehash=%s", basehash)
if bres == sktm.tresult.BASELINE_FAILURE:
self.db.update_baseline(
self.baserepo,
basehash,
self.jk.get_base_commitdate(self.jobname, bid),
sktm.tresult.TEST_FAILURE,
bid
)

patch_url_list = self.jk.get_patchwork(self.jobname, bid)
for patch_url in patch_url_list:
patches.append(self.get_patch_info_from_url(cpw,
patch_url))

if bres != sktm.tresult.BASELINE_FAILURE:
self.db.commit_tested(patches)
else:
raise Exception("Unknown job type: %d" % pjt)
"""Check pending jobs and update their status in the database."""
for (job_type, build_id, pw_instance) in self.pj:

try:
if not self.jk.is_build_complete(self.jobname, build_id):
continue
except: # noqa pylint: disable=bare-except
continue

# Log the completed job and remove it from the list of jobs to
# check
logging.info("job completed: jjid=%d; type=%d", build_id, job_type)
self.pj.remove((job_type, build_id, pw_instance))

# Update baseline records
if job_type == sktm.jtype.BASELINE:
self.db.update_baseline(
self.baserepo,
self.jk.get_base_hash(self.jobname, build_id),
self.jk.get_base_commitdate(self.jobname, build_id),
self.jk.get_result(self.jobname, build_id),
build_id
)
continue

# Update the testing status for the patchwork patches
if job_type == sktm.jtype.PATCHWORK:
# Retrieve the result of the Jenkins build
build_result = self.jk.get_result(self.jobname, build_id)
logging.info("result=%s", build_result)

# Get the URL of the Jenkins build
report_url = self.jk.get_result_url(self.jobname, build_id)
logging.info("url=%s", report_url)

# Note the base hash of the kernel repository that the patches
# were applied to
basehash = self.jk.get_base_hash(self.jobname, build_id)
logging.info("basehash=%s", basehash)

# Get a list of the patchwork URLs in the job and commit them
# to the `patch` table within the database
patch_url_list = self.jk.get_patchwork(self.jobname, build_id)
patches = [
self.get_patch_info_from_url(pw_instance, x)
for x in patch_url_list
]
self.db.commit_tested(patches)

continue

# sktm does not know how to handle this job type
raise Exception("Unknown job type: %d" % job_type)

def wait_for_pending(self):
self.check_pending()
Expand Down