diff --git a/lib/tfw/mixins/supervisor_mixin.py b/lib/tfw/mixins/supervisor_mixin.py index f9bbd6b..cbd6fcd 100644 --- a/lib/tfw/mixins/supervisor_mixin.py +++ b/lib/tfw/mixins/supervisor_mixin.py @@ -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):