From: Sage Weil Date: Sat, 14 Jan 2012 06:08:33 +0000 (-0800) Subject: teuthology-ls: show pid, last line of output for running jobs X-Git-Tag: 1.1.0~2673 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fbfa94bb0933a799b53169cc5010485af1078417;p=teuthology.git teuthology-ls: show pid, last line of output for running jobs --- diff --git a/teuthology/suite.py b/teuthology/suite.py index c9f69d9bd..2f1c82a67 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -168,7 +168,25 @@ def ls(): summary.update(new) except IOError, e: if e.errno == errno.ENOENT: - print "%s (no summary.yaml)" % j + print "%s (no summary.yaml)" % j, + + # pid + try: + pidfile = '%s/%s/pid' % (args.archive_dir, j) + 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: + print ' (pid %s)' % pid, + # tail + tail = os.popen( + 'tail -1 %s/%s/teuthology.log' % (args.archive_dir, j) + ).read().rstrip() + print " (tail '%s')" % tail + except IOError, e: + continue + print '' continue else: raise