You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't run rpyc zerodeploy with basic service I define.
All the examples I found for zerodeploy uses conn = server.classic_connect() which uses some default rpyc service.
I want to deploy my custom service in the remote machine. I tried this code:
importsysimportrpycfromrpyc.utils.zerodeployimportDeployedServerfromplumbumimportSshMachineHOST_NAME="****"USER_NAME="****"# $ ssh-keygen -t ed25519# $ ssh-copy-id user@hostnamessh_machine=SshMachine(host=HOST_NAME, user=USER_NAME, keyfile='~/.ssh/id_ed25519')
server=DeployedServer(remote_machine=ssh_machine)
classMyService(rpyc.ClassicService):
ALIASES= ["foo", "bar"]
defexposed_add(self, a, b):
returna+bconfig= {"allow_all_attrs": True, 'allow_exposed_attrs': True}
# Here I'm trying to use My serviceconn=server.connect(service=MyService, config=config)
print(f'1. rpyc.__version__={rpyc.__version__}')
print(f'2. local platform: {sys.platform}')
print(f'3. local python version: {sys.version}')
print(f'4. aliases: {conn.root.get_service_aliases()}')
print(f'5. remote platform: {conn.modules.sys.platform}')
print(f'6. remote python version: {conn.modules.sys.version}')
print(f'7. {conn.root.add(4, 7)}')
server.close()
Judging by the aliases: ('SLAVE',) I would think that the remote service is not MyService, but if I change MyService to inherit from rpyc.Service instead of rpyc.ClassicService I'm getting the error AttributeError: 'Connection' object has no attribute 'modules' for the second print, so it is MyService (but it's not working as expected).
Also when I override the on_connect() in MyService it's not running.
backgroung:
I want my code to be able to run on any remote machine with no prerequisites.
My other option (which I used before) is to send a server_code.py file and run it (all using SSH), the server_code will run MyService like this: server = rpyc.ThreadedServer(MyService, ..).
I don't like this solution. I need to deal with pip install rpyc, with the temp directory and manage the connection myself. I don't think this is the right way.
rpyc zerodeploy should deal with all of it for me, right?
The text was updated successfully, but these errors were encountered:
Do you know if anyone in the world has really used zerodeploy? Or is it broken and I should give up? I would think it's a problem in my side but I did not find anyone who used it, in all GitHub, isn't it weird?
I assure you that zerodeploy has been used and loved by some users. #377 show that users have had success with it---I'd go through their blog on remote testing. I'll see if I can carve out time soon.
Can't run rpyc zerodeploy with basic service I define.
All the examples I found for
zerodeploy uses conn = server.classic_connect()
which uses some default rpyc service.I want to deploy my custom service in the remote machine. I tried this code:
And I'm getting error for the last (7) print:
Judging by the
aliases: ('SLAVE',)
I would think that the remote service is notMyService
, but if I change MyService to inherit fromrpyc.Service
instead ofrpyc.ClassicService
I'm getting the errorAttributeError: 'Connection' object has no attribute 'modules'
for the second print, so it isMyService
(but it's not working as expected).Also when I override the
on_connect()
in MyService it's not running.backgroung:
I want my code to be able to run on any remote machine with no prerequisites.
My other option (which I used before) is to send a server_code.py file and run it (all using SSH), the server_code will run MyService like this:
server = rpyc.ThreadedServer(MyService, ..)
.I don't like this solution. I need to deal with
pip install rpyc
, with the temp directory and manage the connection myself. I don't think this is the right way.rpyc zerodeploy should deal with all of it for me, right?
The text was updated successfully, but these errors were encountered: