def __init__(self): ObjBase.__init__(self) # {name : workerObj} self.workers = dict() self.logger = get_logger('WorkerService_%s' % getnodename())
def configure(self): pyro_obj = ObjBase() pyro_obj.delegateTo(self.service_obj) (self.pd, pd) = (Daemon(), Daemon()) ns = NameServerLocator().getNS() pd.useNameServer(ns) pyro_id = 'REMOTESVC' + to_str(self.service_id) try: ns.unregister(pyro_id) except NamingError: pass pd.connect(pyro_obj, pyro_id) self.service_obj.set_external_ref(pd.getProxyForObj(pyro_obj))
def register_service(self, service_obj): pyro_obj = ObjBase() pyro_obj.delegateTo(service_obj) service_id = service_obj.getid() pyro_id = 'LOCALSVC' + to_str(service_id) ns = self.pd.getNameServer() try: ns.unregister(pyro_id) except NamingError: pass self.pd.connect(pyro_obj, pyro_id) service_obj.set_external_ref(self.pd.getProxyForObj(pyro_obj)) service_obj._PyroLocalDaemon__pyro_obj = pyro_obj
def register_service(self, service_obj): pyro_obj = ObjBase() pyro_obj.delegateTo(service_obj) service_id = service_obj.getid() pyro_id = "LOCALSVC" + to_str(service_id) ns = self.pd.getNameServer() #Remove any existing reference to this id try: ns.unregister(pyro_id) except NamingError: #the name is not found, which is fine pass self.pd.connect(pyro_obj, pyro_id) service_obj.set_external_ref(self.pd.getProxyForObj(pyro_obj)) service_obj.__pyro_obj = pyro_obj
def configure(self): pyro_obj = ObjBase() pyro_obj.delegateTo(self.service_obj) #Start the Pyro Daemon and register the ProcessInst object self.pd = pd = Daemon() ns = NameServerLocator().getNS() pd.useNameServer(ns) pyro_id = "REMOTESVC" + to_str(self.service_id) #Remove any existing reference to this id try: ns.unregister(pyro_id) except NamingError: #the name is not found, which is fine pass pd.connect(pyro_obj, pyro_id) #set the pyro self reference self.service_obj.set_external_ref(pd.getProxyForObj(pyro_obj))
def __init__( self, db, verbose ): ObjBase.__init__(self) self.__db = db self.__verbose = verbose