--- /dev/null
+import argparse
+from teuthology.suite import ls
+
+
+def main():
+ args = parse_args()
+ ls(args.archive_dir, args.verbose)
+
+
+def parse_args():
+ parser = argparse.ArgumentParser(description='List teuthology job results')
+ parser.add_argument(
+ '--archive-dir',
+ metavar='DIR',
+ help='path under which to archive results',
+ required=True,
+ )
+ parser.add_argument(
+ '-v', '--verbose',
+ action='store_true', default=False,
+ help='show reasons tests failed',
+ )
+ return parser.parse_args()
'teuthology = teuthology.run:main',
'teuthology-nuke = scripts.nuke:main',
'teuthology-suite = scripts.suite:main',
- 'teuthology-ls = teuthology.suite:ls',
+ 'teuthology-ls = scripts.ls:main',
'teuthology-worker = teuthology.queue:worker',
'teuthology-lock = teuthology.lock:main',
'teuthology-schedule = teuthology.run:schedule',
return out
return []
-def ls():
- parser = argparse.ArgumentParser(description='List teuthology job results')
- parser.add_argument(
- '--archive-dir',
- metavar='DIR',
- help='path under which to archive results',
- required=True,
- )
- parser.add_argument(
- '-v', '--verbose',
- action='store_true', default=False,
- help='show reasons tests failed',
- )
- args = parser.parse_args()
- for j in get_jobs(args.archive_dir):
- job_dir = os.path.join(args.archive_dir, j)
+def ls(archive_dir, verbose):
+ for j in get_jobs(archive_dir):
+ job_dir = os.path.join(archive_dir, j)
summary = {}
try:
with file(os.path.join(job_dir, 'summary.yaml')) as f:
if os.path.isfile(pidfile):
pid = open(pidfile, 'r').read()
if os.path.isdir("/proc/%s" % pid):
- cmdline = open('/proc/%s/cmdline' % pid, 'r').read()
- if cmdline.find(args.archive_dir) >= 0:
+ cmdline = open('/proc/%s/cmdline' % pid,
+ 'r').read()
+ if cmdline.find(archive_dir) >= 0:
print '(pid %s)' % pid,
found = True
if not found:
print '(no process or summary.yaml)',
# tail
tail = os.popen(
- 'tail -1 %s/%s/teuthology.log' % (args.archive_dir, j)
+ 'tail -1 %s/%s/teuthology.log' % (archive_dir, j)
).read().rstrip()
print tail,
except IOError, e:
success='pass' if summary.get('success', False) else 'FAIL',
duration=int(summary.get('duration', 0)),
)
- if args.verbose and 'failure_reason' in summary:
+ if verbose and 'failure_reason' in summary:
print ' {reason}'.format(reason=summary['failure_reason'])
def generate_coverage(args):