Commit 1da80792 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Yusei Tahara

follow API changes of psutil-2.0.0.

parent b3a5d1b4
...@@ -85,7 +85,7 @@ class Application(object): ...@@ -85,7 +85,7 @@ class Application(object):
process = Process(pid) process = Process(pid)
try: try:
for connection in process.get_connections(): for connection in process.connections():
if connection.status == 'LISTEN' and \ if connection.status == 'LISTEN' and \
connection.local_address[1] == self.port: connection.local_address[1] == self.port:
return True return True
......
...@@ -117,8 +117,8 @@ class OpenOffice(Application): ...@@ -117,8 +117,8 @@ class OpenOffice(Application):
def _releaseOpenOfficePort(self): def _releaseOpenOfficePort(self):
for process in psutil.process_iter(): for process in psutil.process_iter():
try: try:
if process.exe == join(self.office_binary_path, self._bin_soffice): if process.exe() == join(self.office_binary_path, self._bin_soffice):
for connection in process.get_connections(): for connection in process.connections():
if connection.status == "LISTEN" and \ if connection.status == "LISTEN" and \
connection.local_address[1] == self.port: connection.local_address[1] == self.port:
process.terminate() process.terminate()
......
...@@ -52,7 +52,7 @@ class MonitorMemory(Monitor, Process): ...@@ -52,7 +52,7 @@ class MonitorMemory(Monitor, Process):
if not hasattr(self, 'process') or \ if not hasattr(self, 'process') or \
self.process.pid != int(self.openoffice.pid()): self.process.pid != int(self.openoffice.pid()):
self.create_process() self.create_process()
return self.process.get_memory_info().rss / (1024 * 1024) return self.process.memory_info().rss / (1024 * 1024)
except TypeError: except TypeError:
logger.debug("OpenOffice is stopped") logger.debug("OpenOffice is stopped")
return 0 return 0
......
...@@ -17,7 +17,7 @@ from signal import SIGQUIT ...@@ -17,7 +17,7 @@ from signal import SIGQUIT
def wait_use_port(pid, timeout_limit=30): def wait_use_port(pid, timeout_limit=30):
process = psutil.Process(pid) process = psutil.Process(pid)
for n in range(timeout_limit): for n in range(timeout_limit):
if len(process.get_connections()) > 0: if len(process.connections()) > 0:
return True return True
sleep(1) sleep(1)
return False return False
......
...@@ -14,7 +14,7 @@ install_requires = [ ...@@ -14,7 +14,7 @@ install_requires = [
'PasteDeploy', 'PasteDeploy',
'PasteScript', 'PasteScript',
'WSGIUtils', 'WSGIUtils',
'psutil>=0.2.0', 'psutil>=2.0.0',
'lxml', 'lxml',
'python-magic', 'python-magic',
'argparse', '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