mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 06:22:55 +00:00 
			
		
		
		
	Refactor SupervisorMixin to be stateless
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user