Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Move JobType to misc.py
Browse files Browse the repository at this point in the history
Fixes #121
  • Loading branch information
danghai authored and veruu committed Aug 9, 2018
1 parent 21f7b56 commit a36320b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
18 changes: 5 additions & 13 deletions sktm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,12 @@
import subprocess
import time

import enum

import sktm.db
import sktm.jenkins
from sktm.misc import TestResult
from sktm.misc import TestResult, JobType
import sktm.patchwork


class JobType(enum.IntEnum):
"""Job type"""
BASELINE = 0
PATCHWORK = 1


# TODO This is no longer just a watcher. Rename/refactor/describe accordingly.
class watcher(object):
def __init__(self, jenkins_project, dbpath, patch_filter, makeopts=None):
Expand Down Expand Up @@ -163,7 +155,7 @@ def add_pw(self, baseurl, pname, lpatch=None, apikey=None, skip=[]):
# FIXME Fix the name, this function doesn't check anything by itself
def check_baseline(self):
"""Submit a build for baseline"""
self.pj.append((sktm.JobType.BASELINE,
self.pj.append((JobType.BASELINE,
self.jk.build(baserepo=self.baserepo,
ref=self.baseref,
baseconfig=self.cfgurl,
Expand Down Expand Up @@ -292,7 +284,7 @@ def check_patchwork(self):
for series in series_list:
# Submit and remember a Jenkins build for the series
url_list = series.get_patch_url_list()
self.pj.append((sktm.JobType.PATCHWORK,
self.pj.append((JobType.PATCHWORK,
self.jk.build(
baserepo=self.baserepo,
ref=stablecommit,
Expand Down Expand Up @@ -329,15 +321,15 @@ def check_pending(self):
logging.warning("job completed with an error, ignoring")
continue

if pjt == sktm.JobType.BASELINE:
if pjt == JobType.BASELINE:
self.db.update_baseline(
self.baserepo,
basehash,
basedate,
bres,
bid
)
elif pjt == sktm.JobType.PATCHWORK:
elif pjt == JobType.PATCHWORK:
patches = list()

patch_url_list = self.jk.get_patch_url_list(bid)
Expand Down
6 changes: 6 additions & 0 deletions sktm/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class TestResult(enum.IntEnum):
TEST_FAILURE = 4


class JobType(enum.IntEnum):
"""Job type"""
BASELINE = 0
PATCHWORK = 1


def join_with_slash(base, *suffix_tuple):
"""
Join parts of URL or path by slashes. Trailing slash of base, and each
Expand Down

0 comments on commit a36320b

Please sign in to comment.