MCPcopy Create free account
hub / github.com/apache/cloudstack / find_pid

Method find_pid

systemvm/debian/opt/cloud/bin/cs/CsProcess.py:41–51  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

39 CsHelper.execute("kill -9 %s" % p)
40
41 def find_pid(self):
42 self.pid = []
43 items = len(self.search)
44 for i in CsHelper.execute("ps aux"):
45 proc = re.split(r"\s+", i)[10:]
46 matches = len([m for m in proc if m in self.search])
47 if matches == items:
48 self.pid.append(re.split(r"\s+", i)[1])
49
50 logging.debug("CsProcess:: Searching for process ==> %s and found PIDs ==> %s", self.search, self.pid)
51 return self.pid
52
53 def find(self):
54 has_pid = len(self.find_pid()) > 0

Callers 2

kill_allMethod · 0.95
findMethod · 0.95

Calls 3

debugMethod · 0.80
executeMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected