Refactor SupervisorMixin to be stateless

This commit is contained in:
Kristóf Tóth 2018-02-27 15:54:10 +01:00
parent 57bd2aec45
commit 789db7416d

View File

@ -8,13 +8,13 @@ from tfw.config import tfwenv
class SupervisorMixin:
supervisor = xmlrpc.client.ServerProxy(tfwenv.SUPERVISOR_HTTP_URI).supervisor
def stop_process(self):
def stop_process(self, process_name):
with suppress(SupervisorFault):
self.supervisor.stopProcess(self.process_name)
self.supervisor.stopProcess(process_name)
def start_process(self):
self.supervisor.startProcess(self.process_name)
def start_process(self, process_name):
self.supervisor.startProcess(process_name)
def restart_process(self):
self.stop_process()
self.start_process()
def restart_process(self, process_name):
self.stop_process(process_name)
self.start_process(process_name)