Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

gedis client doesnt have actor attribute #17

Open
0xIslamTaha opened this issue Jan 21, 2019 · 3 comments
Open

gedis client doesnt have actor attribute #17

0xIslamTaha opened this issue Jan 21, 2019 · 3 comments
Labels
Milestone

Comments

@0xIslamTaha
Copy link
Contributor

0xIslamTaha commented Jan 21, 2019

Regarding the docs, there is an actor attribute for the client. I should use this attribute to access the actor's methods.

Actual result

In [18]: client = j.clients.gedis.configure(name='test', host='0.0.0.0', port=9900)

In [19]: 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'

In [20]: 

Env
DigitalMe : master
OS: ubuntu 18

@zaibon
Copy link
Contributor

zaibon commented Jan 21, 2019

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

@zaibon zaibon closed this as completed Jan 21, 2019
@0xIslamTaha
Copy link
Contributor Author

0xIslamTaha commented Jan 21, 2019

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'


@0xIslamTaha 0xIslamTaha reopened this Jan 21, 2019
@0xIslamTaha
Copy link
Contributor Author

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'

@rkhamis rkhamis added this to the now milestone May 28, 2019
@despiegk despiegk modified the milestones: now, next Jun 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants