Support creating thread-local xmlrpc clients in SupervisorBaseMixin

This commit is contained in:
Kristóf Tóth 2018-05-29 16:09:41 +02:00
parent 780d6a9b3c
commit 9f6418bf60

View File

@ -9,8 +9,18 @@ from os import remove
from tfw.config import TFWENV
def get_supervisor_instance():
return xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor
class SupervisorBaseMixin:
supervisor = xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor
supervisor = get_supervisor_instance()
def threadlocalise_supervisor_instance(self):
"""
Give this instance non-static, thread local xmlrpc client
"""
self.supervisor = get_supervisor_instance()
class SupervisorMixin(SupervisorBaseMixin):