summaryrefslogtreecommitdiff
path: root/pytests
diff options
context:
space:
mode:
authorMikhail Shchatko <mikhail.shchatko@mongodb.com>2021-04-30 16:02:05 +0300
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-12 13:24:31 +0000
commit8c0f28f029863fc38076e57c0b9d4244bc2f8c41 (patch)
tree8a670174414c1fff87cca0cf7b51660898cf7830 /pytests
parentef51e27f1bfb8c2f16aa6cf38820830410f4f2df (diff)
downloadmongo-8c0f28f029863fc38076e57c0b9d4244bc2f8c41.tar.gz
SERVER-37125 Remove unused ProcessControl code
Diffstat (limited to 'pytests')
-rwxr-xr-xpytests/powertest.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/pytests/powertest.py b/pytests/powertest.py
index 6c2904132ef..55b1aeb37d8 100755
--- a/pytests/powertest.py
+++ b/pytests/powertest.py
@@ -733,24 +733,18 @@ class NamedTempFile(object):
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:
@@ -760,16 +754,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 = []
@@ -781,7 +765,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