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

Commit

Permalink
Merge ec1c9f6 into 6b3daf0
Browse files Browse the repository at this point in the history
  • Loading branch information
major committed Jul 17, 2018
2 parents 6b3daf0 + ec1c9f6 commit ebacb93
Showing 1 changed file with 53 additions and 38 deletions.
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

0 comments on commit ebacb93

Please sign in to comment.