diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-12-19 15:54:11 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-12-19 15:54:11 +0000 |
commit | 7418a596b5714f16f0c6f8700e8659a948da0fe7 (patch) | |
tree | 95f005787a1de7e0a97ac1c3931015c76fbf245e | |
parent | a4a03a8262932c6d154f4183365e5cde555f925c (diff) |
Fix up parse so it can reparse a job - allows continuous status
Signed-off-by: Martin Bligh <mbligh@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@1087 592f7852-d20e-0410-864c-8624ca9c26a4
-rwxr-xr-x | server/autoserv | 4 | ||||
-rwxr-xr-x | server/server_job.py | 10 | ||||
-rwxr-xr-x | tko/parse | 30 | ||||
-rwxr-xr-x | tko/parse.py | 12 |
4 files changed, 37 insertions, 19 deletions
diff --git a/server/autoserv b/server/autoserv index 426ec395..401ace27 100755 --- a/server/autoserv +++ b/server/autoserv @@ -80,12 +80,12 @@ if verify or repair: sys.exit(0) job = server_job.server_job(parser.args[0], parser.args[1:], results, label, - user, client) + user, machines, client) job.stdout.tee_redirect(os.path.join(results, 'debug', 'autoserv.stdout')) job.stderr.tee_redirect(os.path.join(results, 'debug', 'autoserv.stderr')) try: - job.run(machines, reboot, install_before, install_after) + job.run(reboot, install_before, install_after) except: traceback.print_exc() diff --git a/server/server_job.py b/server/server_job.py index 637bc203..5a8532b1 100755 --- a/server/server_job.py +++ b/server/server_job.py @@ -135,7 +135,8 @@ class server_job: the control file for this job """ - def __init__(self, control, args, resultdir, label, user, client=False): + def __init__(self, control, args, resultdir, label, user, machines, + client = False): """ control The control file (pathname of) @@ -168,6 +169,7 @@ class server_job: self.label = label self.user = user self.args = args + self.machines = machines self.client = client self.record_prefix = '' @@ -176,14 +178,16 @@ class server_job: if os.path.exists(self.status): os.unlink(self.status) - job_data = { 'label' : label, 'user' : user} + job_data = { 'label' : label, 'user' : user, + 'hostname' : ','.join(machines) } write_keyval(self.resultdir, job_data) - def run(self, machines, reboot = False, install_before = False, + def run(self, reboot = False, install_before = False, install_after = False, namespace = {}): # use a copy so changes don't affect the original dictionary namespace = namespace.copy() + machines = self.machines self.aborted = False namespace['machines'] = machines @@ -5,6 +5,7 @@ from traceback import format_exception usage = """\ usage: parse [-m] # Send mail for FAILED tests + [-r] # Reparse the results of a job [-o directory] # Specify results directory directly <top level results directory> # Specify top level results directory """ @@ -20,10 +21,10 @@ def format_error(): try: - opts, args = getopt.getopt(sys.argv[1:], "hmo:l:", ["help"]) + opts, args = getopt.getopt(sys.argv[1:], "hrmo:l:", ["help"]) except getopt.GetoptError: # print help information and exit: - usage() + print usage, sys.exit(2) if len(sys.argv) < 2: @@ -32,6 +33,7 @@ if len(sys.argv) < 2: singledir = None mailit = False +reparse = False level = 1 for name, value in opts: if name in ("-h", "--help"): @@ -39,6 +41,8 @@ for name, value in opts: sys.exit() if name == "-m": mailit = True + if name == "-r": + reparse = True if name in ("-o"): singledir = value if name in ("-l"): @@ -80,24 +84,28 @@ def mailfailure(jobname, job, mesgtxt): message_header + mesgtxt) +def dprint(string): + if debug: + print string + + def do_parse(jobname, path): """ Parse a single job. Optionally send email on failure, etc. """ - if debug: - print '\nScanning %s (%s)' % (jobname, path) - if db.find_job(jobname): # Job has already been parsed - if debug: - print '! Already processed' + dprint('\nScanning %s (%s)' % (jobname, path)) + if reparse and db.find_job(jobname): + dprint('! Deleting old copy of job results, to reparse it') + db.delete_job(jobname) + if db.find_job(jobname): # Job has already been parsed + dprint('! Already processed') return job = parse.job(path) if not job: - if debug: - print '! Failed to parse job (no status file?)' + dprint('! Failed to parse job (no status file?)') return if not job.kernel: - if debug: - print '! Failed to find kernel for job' + dprint('! Failed to find kernel for job') return print '+ Parsing ' + path print '* jobname, kernel version: %s %s' % (jobname, job.kernel.base) diff --git a/tko/parse.py b/tko/parse.py index e8fc1938..2cbfa36e 100755 --- a/tko/parse.py +++ b/tko/parse.py @@ -67,7 +67,9 @@ class job: def __init__(self, dir): self.dir = dir self.control = os.path.join(dir, "control") - self.status = os.path.join(dir, "status") + self.status = os.path.join(dir, "status.log") + if not os.path.exists(self.status): + self.status = os.path.join(dir, "status") self.variables = {} self.tests = [] self.kernel = None @@ -81,6 +83,8 @@ class job: self.user = keyval.get('user', None) self.label = keyval.get('label', None) self.machine = keyval.get('hostname', None) + if self.machine: + assert ',' not in self.machine self.machine_owner = keyval.get('owner', None) if not self.machine: @@ -212,7 +216,7 @@ class job: class kernel: def __init__(self, topdir): - self.base = None + self.base = 'UNKNOWN' self.patches = [] patch_hashes = [] # HACK. we don't have proper build tags in the status file yet @@ -240,7 +244,9 @@ class kernel: re.sub(r'-autotest$', '', self.base) break print 'kernel.__init__() found kernel version %s' % self.base - if self.base: + if self.base == 'UNKNOWN': + self.kernel_hash = 'UNKNOWN' + else: self.kernel_hash = self.get_kver_hash(self.base, patch_hashes) |