| 1245 | self.started = False |
| 1246 | |
| 1247 | def start(self): |
| 1248 | try: |
| 1249 | f = open(self.procfile, 'r') |
| 1250 | except OSError as e: |
| 1251 | logging.getLogger(__name__).warning('/proc not available for stats: %s', e, exc_info=e) |
| 1252 | sys.stderr.flush() |
| 1253 | return |
| 1254 | |
| 1255 | import subprocess |
| 1256 | with f: |
| 1257 | watchdog_script = findfile("memory_watchdog.py") |
| 1258 | self.mem_watchdog = subprocess.Popen([sys.executable, watchdog_script], |
| 1259 | stdin=f, |
| 1260 | stderr=subprocess.DEVNULL) |
| 1261 | self.started = True |
| 1262 | |
| 1263 | def stop(self): |
| 1264 | if self.started: |