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-04-30 17:57:40 +0000
commit508ae0386a99d41f107491d352322c05158bbdf8 (patch)
tree24dfaacf2a366b97ebb980b53936fc0b3672012d /pytests
parent2002e6c2cb0e90fa47b30bfea8add8fbc3a412b5 (diff)
downloadmongo-508ae0386a99d41f107491d352322c05158bbdf8.tar.gz
SERVER-37125 Remove unused ProcessControl code
(cherry picked from commit b9d9a010494018dce57a95793cb81a4a317119aa)
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 5670197c720..972f15b1e99 100755
--- a/pytests/powertest.py
+++ b/pytests/powertest.py
@@ -731,24 +731,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:
@@ -758,16 +752,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 = []
@@ -779,7 +763,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