Permalink
Browse files

Code now cleans up after its zombie processes.

  • Loading branch information...
dhustigschultz committed Sep 6, 2016
1 parent 8f760a3 commit 886551cda2b5a8bb6d0fc15284196fec5ea4bb6f
Showing with 4 additions and 0 deletions.
  1. +4 −0 scripts/learning/src/concurrent_scheduler.py
@@ -1,6 +1,7 @@
import logging
import time
import psutil
import os
class ConcurrentScheduler:
@@ -45,6 +46,9 @@ def __checkProcesses(self):
if proc.status() == psutil.STATUS_ZOMBIE:
logging.info("Process with ID %d is now a zombie process. Mark it as complete." % activeProc.pid)
completed.append(activeProc)
# Releasing the processID from each zombie process
childPid, status = os.waitpid(activeProc.pid, 0)
logging.info("Zombie process ID %d, with exit status %d, has been removed from the process table and can be reused." % (childPid, status))
for completeProc in completed:
self.jobsProcessing.remove(completeProc)

0 comments on commit 886551c

Please sign in to comment.