Commit 6f50d16a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

CHERRY-PICKED: follow API changes of psutil-2.0.0.

parent dc954248
......@@ -85,7 +85,7 @@ class Application(object):
process = Process(pid)
try:
for connection in process.get_connections():
for connection in process.connections():
if connection.status == 'LISTEN' and \
connection.local_address[1] == self.port:
return True
......
......@@ -117,8 +117,8 @@ class OpenOffice(Application):
def _releaseOpenOfficePort(self):
for process in psutil.process_iter():
try:
if process.exe == join(self.office_binary_path, self._bin_soffice):
for connection in process.get_connections():
if process.exe() == join(self.office_binary_path, self._bin_soffice):
for connection in process.connections():
if connection.status == "LISTEN" and \
connection.local_address[1] == self.port:
process.terminate()
......
......@@ -52,7 +52,7 @@ class MonitorMemory(Monitor, Process):
if not hasattr(self, 'process') or \
self.process.pid != int(self.openoffice.pid()):
self.create_process()
return self.process.get_memory_info().rss / (1024 * 1024)
return self.process.memory_info().rss / (1024 * 1024)
except TypeError:
logger.debug("OpenOffice is stopped")
return 0
......
......@@ -17,7 +17,7 @@ from signal import SIGQUIT
def wait_use_port(pid, timeout_limit=30):
process = psutil.Process(pid)
for n in range(timeout_limit):
if len(process.get_connections()) > 0:
if len(process.connections()) > 0:
return True
sleep(1)
return False
......
......@@ -14,7 +14,7 @@ install_requires = [
'PasteDeploy',
'PasteScript',
'WSGIUtils',
'psutil>=0.2.0',
'psutil>=2.0.0',
'lxml',
'python-magic',
'argparse',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment