示例#1
0
    def spawn_id(self, oid, module, kclass, params=[]):
        module_ = self.my_import(module)

        #instance object save to obj variable
        obj = getattr(module_, kclass)(*params)

        #aref object
        aref = 'atom://' + self.name + '/' + module + '/' + kclass + '/' + oid

        #Now we need registry object to Pyactive object. But also it's necessary create new Pyactive instance.
        a = controller.Pyactive()

        #Registry object to Pyactive
        a.registry_object(obj)

        #Insert aref to Pyactive object
        a.set_aref(aref)
        a.host = self
        obj.id = oid
        obj._atom = a
        refList = list(methodsWithDecorator(getattr(module_, kclass), 'ref'))

        if self.TRACE:
            a.send2 = tracer2(a.send2, self.tracer)

        if len(refList) != 0:
            a.ref_on()

        if self.TRACE:
            a.receive = tracer(a.receive, self.tracer)

        a.parallelList = list(
            methodsWithDecorator(getattr(module_, kclass), 'parallel'))
        a.init_parallel()
        #Finally run object because it's ready now
        a.run()

        #Now registry new object in Host, because need check duplicates
        self.register(aref, a)

        obj.proxy = Auto_Proxy(obj, aref)
        client = self.load_client(a.channel, aref, aref)
        return client
示例#2
0
 def load_client(self, channel, aref, _from):
 
     scheme, host, module, kclass, oid, = self.parse_aref(aref)
     if module != 'controller':
         module_ = self.my_import(module)
         kclass_ = getattr(module_, kclass)
     else:
         kclass_ = self.__class__
     client = controller.Pyactive()
     client.out = channel
     client.target = host
     client.set_aref(aref)
     client.asyncList = list(methodsWithDecorator(kclass_, 'async'))
     client.refList = list(methodsWithDecorator(kclass_, 'ref'))
     client.syncList = methodsWithSync(kclass_) 
     client.host = self
     select_time(packageName)
     proxy = Proxy(client, _from)
     return proxy
示例#3
0
    def load_client(self, channel, aref, _from):

        scheme, host, module, kclass, oid, = self.parse_aref(aref)
        if module != 'controller':
            module_ = self.my_import(module)
            kclass_ = getattr(module_, kclass)
        else:
            kclass_ = self.__class__
        client = controller.Pyactive()
        client.out = channel
        client.target = host
        client.set_aref(aref)
        client.asyncList = list(methodsWithDecorator(kclass_, 'async'))
        client.refList = list(methodsWithDecorator(kclass_, 'ref'))
        client.syncList = methodsWithSync(kclass_)
        client.host = self
        select_time(packageName)
        proxy = Proxy(client, _from)
        return proxy
示例#4
0
 def spawn_id(self, oid, module, kclass, params=[]):
     module_ = self.my_import(module)
     
     #instance object save to obj variable
     obj = getattr(module_, kclass)(*params)
                   
     #aref object
     aref = 'atom://' + self.name + '/' + module + '/' + kclass + '/' + oid
     
     #Now we need registry object to Pyactive object. But also it's necessary create new Pyactive instance.
     a = controller.Pyactive()
     
     #Registry object to Pyactive
     a.registry_object(obj)
     
     #Insert aref to Pyactive object
     a.set_aref(aref)
     a.hosthost = self
     obj.id = oid
     obj._atom = a
     refList = list(methodsWithDecorator(getattr(module_, kclass), 'ref'))
     
     if self.TRACE:
         a.send2 = tracer2(a.send2, self.tracer)
     
     if len(refList) != 0:
         a.ref_on()
     
     if self.TRACE:
         a.receive = tracer(a.receive, self.tracer)
            
     a.parallelList = list(methodsWithDecorator(getattr(module_, kclass), 'parallel'))
     a.init_parallel()    
     #Finally run object because it's ready now
     a.run()
     
     #Now registry new object in Host, because need check duplicates 
     self.register(aref, a)
     
     obj.proxy = Auto_Proxy(obj, aref)
     client = self.load_client(a.channel, aref, aref, a.group)
     return client