summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Shchatko <mikhail.shchatko@mongodb.com>2021-04-30 13:09:41 +0300
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-30 17:53:45 +0000
commit17d7453f95b4c1dfa439adb4532a82015c9a7d81 (patch)
tree3f028b0d9ece4dc990b414b524ea14ef63da6b27
parentb914d1a628927de7eb6e03e8355861c9ddc8f116 (diff)
downloadmongo-17d7453f95b4c1dfa439adb4532a82015c9a7d81.tar.gz
SERVER-37125 Remove unused ProcessControl code
(cherry picked from commit 08459b3b33a4c5567bcea75d3d33e2937a467252)
-rw-r--r--buildscripts/resmokelib/powercycle/lib/process_control.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/buildscripts/resmokelib/powercycle/lib/process_control.py b/buildscripts/resmokelib/powercycle/lib/process_control.py
index bd29facf98e..309c30f280b 100644
--- a/buildscripts/resmokelib/powercycle/lib/process_control.py
+++ b/buildscripts/resmokelib/powercycle/lib/process_control.py
@@ -8,24 +8,18 @@ LOGGER = logging.getLogger(__name__)
class ProcessControl(object):
"""Process control class.
- Control processes either by name or a list of pids. If name is supplied, then
- all matching pids are controlled.
+ Control processes by name. All matching by supplied name
+ pids are controlled.
"""
- def __init__(self, name=None, pids=None):
- """Provide either 'name' or 'pids' to control the process."""
- if not name and not pids:
- raise Exception("Either 'process_name' or 'pids' must be specifed")
+ def __init__(self, name):
+ """Provide 'name' to control the process."""
self.name = name
self.pids = []
- if pids:
- self.pids = pids
self.procs = []
def get_pids(self):
"""Return list of process ids for process 'self.name'."""
- if not self.name:
- return self.pids
self.pids = []
for proc in psutil.process_iter():
try:
@@ -35,16 +29,6 @@ class ProcessControl(object):
pass
return self.pids
- def get_name(self):
- """Return process name or name of first running process from pids."""
- if not self.name:
- for pid in self.get_pids():
- proc = psutil.Process(pid)
- if psutil.pid_exists(pid):
- self.name = proc.name()
- break
- return self.name
-
def get_procs(self):
"""Return a list of 'proc' for the associated pids."""
procs = []
@@ -56,7 +40,7 @@ class ProcessControl(object):
return procs
def is_running(self):
- """Return true if any process is running that either matches on name or pids."""
+ """Return true if any process is running that matches pids."""
for pid in self.get_pids():
if psutil.pid_exists(pid):
return True