From: Brian Warner Date: Thu, 7 Aug 2008 04:17:05 +0000 (-0700) Subject: misc/cpu-watcher.tac: tolerate missing pidfiles, just skip over that sample X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/quickstart.html?a=commitdiff_plain;h=4863b17371b7cd07a2bc4fdd703a6a9f8f6acb49;p=tahoe-lafs%2Ftahoe-lafs.git misc/cpu-watcher.tac: tolerate missing pidfiles, just skip over that sample --- diff --git a/misc/cpu-watcher.tac b/misc/cpu-watcher.tac index 4992a1c4..4546454e 100644 --- a/misc/cpu-watcher.tac +++ b/misc/cpu-watcher.tac @@ -57,14 +57,19 @@ def read_pids_txt(): name = parts[1] else: name = pidthing + pid = None try: pid = int(pidthing) except ValueError: pidfile = os.path.expanduser(pidthing) if os.path.isdir(pidfile): pidfile = os.path.join(pidfile, "twistd.pid") - pid = int(open(pidfile, "r").read().strip()) - processes.append( (pid, name) ) + try: + pid = int(open(pidfile, "r").read().strip()) + except EnvironmentError: + pass + if pid is not None: + processes.append( (pid, name) ) return processes Averages = ListOf( TupleOf(str, float, float, float) )