Esempio n. 1
0
    def test_neuron_usepki_basics(self):
        net = self.initNeuNet(usepki=True)

        net.neu3.share('foo',FooBar())

        dend = s_neuron.openlink(net.link0)

        path = '%s/foo' % (net.neu3.iden,)
        prox = dend.open(path)

        task = ('foo',(30,),{})

        job = dend.call( net.neu3.iden, 'foo', task )

        self.assertIsNotNone(job)

        self.assertEqual( dend.sync(job), 50)

        self.assertEqual( prox.foo(11), 31 )

        data = {}
        def ondone(j):
            data['ret'] = s_async.jobret(j)

        job = prox.foo(12, ondone=ondone)

        self.assertEqual( dend.sync(job), 32 )
        self.assertEqual( data.get('ret'), 32 )

        self.finiNeuNet(net)
Esempio n. 2
0
    def newp_dendrite_share(self):
        net = self.initNeuNet()

        dend0 = s_neuron.openlink(net.link0)
        dend3 = s_neuron.openlink(net.link3)

        w0 = self.getTestWait(net.neu0, 2, 'neu:dend:init')

        dend3.share('foobar0', FooBar(), tags=('foo.bar.0',))
        dend3.share('foobar1', FooBar(), tags=('foo.bar.1',))

        w0.wait()

        self.assertIsNotNone( dend0.getDendByIden('foobar0') )
        self.assertIsNotNone( dend0.getDendByIden('foobar1') )

        bytag = dend0.getDendsByTag('foo.bar')
        self.assertEqual( len(bytag), 2 )

        bytag = dend0.getDendsByTag('foo.bar.0')
        self.assertEqual( len(bytag), 1 )
Esempio n. 3
0
    def newp_neuron_ping(self):
        net = self.initNeuNet()

        dend = s_neuron.openlink(net.link0)

        path = '%s/neuron' % (net.neu2.iden,)
        prox1 = dend.open(path)

        pong = prox1.ping()

        self.assertIsNotNone(pong)
        self.assertEqual( pong.get('iden'), net.neu2.iden )

        self.finiNeuNet(net)