Open 0xIslamTaha opened 5 years ago
In the doc we load the an actor called actor
on the server. So when you get a client to this gedis server, the client get its code generate to talk to the actor, thats what is showed in cl.actor.ping
I did that. Here is the server config
In [2]: server = j.servers.gedis.get(name='test')
Mon21 10:18 InstallTools.py - 412: DEBUG Remove file with path: /sandbox/var/codegen/gedis/test/server
Mon21 10:18 InstallTools.py - 412: DEBUG Remove file with path: /sandbox/var/codegen/gedis/test/client
In [3]: server.actor_add("/sandbox/tmp/actor.py")
In [4]: server.start()
and here is the actor
In [27]: !cat /sandbox/tmp/actor.py
from Jumpscale import j
JSBASE = j.application.JSBaseClass
class actor(JSBASE):
def __init__(self):
JSBASE.__init__(self)
def ping(self):
return "pong"
and here is the error
In [28]: client = j.clients.gedis.configure(name='test', host='0.0.0.0', port=9900)
In [29]: client.actor.ping()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/sandbox/bin/js_shell in <module>()
----> 1 client.actor.ping()
AttributeError: 'GedisClientCmds' object has no attribute 'actor'
when I got the client with a different way, it worked well
In [10]: server = j.servers.gedis.get(name='test')
In [11]: client = server.client_get()
key:core_schemas_get res:None
cache miss:core_schemas_get (<function GedisClient.generate.<locals>.do at 0x7f41c8471ae8>)
In [12]: client.actor.ping
Out[12]: <bound method CMDS.ping of <65c8f7e6f9f81bc605c8d54a9fc7e662.CMDS object at 0x7f41c82a41d0>>
In [13]: client.actor.ping()
Out[13]: b'pong'
Regarding the docs, there is an actor attribute for the client. I should use this attribute to access the actor's methods.
Actual result
Env DigitalMe : master OS: ubuntu 18