Using command chain with existing xmlrpc server

   1868   2   2
User Avatar
Member
8 posts
Joined: Dec. 2014
Offline
Hi Im trying to use houdinis command chain with an existing xmlrpc server that Im running outside of houdini. I might be misunderstanding how it all works!

Im starting with the example here -
https://docs.python.org/3/library/xmlrpc.server.html#module-xmlrpc.server [docs.python.org]
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler

class RequestHandler(SimpleXMLRPCRequestHandler):
    rpc_paths = ('/RPC2',)

with SimpleXMLRPCServer(('localhost', 8000),
                        requestHandler=RequestHandler) as server:
    server.register_introspection_functions()

    # Register pow() function; this will use the value of
    # pow.__name__ as the name, which is just 'pow'.
    server.register_function(pow)

    # Register a function under a different name, using
    # register_function as a decorator. *name* can only be given
    # as a keyword argument.
    @server.register_function(name='add')
    def adder_function(x, y):
        return x + y

    # Register a function under function.__name__.
    @server.register_function
    def mul(x, y):
        return x * y

    server.serve_forever()

It works great! I can connect to it outside of houdini and run the example functions. all good.

I can also connect to this(external to houdini) server in tops using a python command chain using the "connect to existing server" option.

As soon as I add a "send command" top to this command chain I get the following error-
Error running callback 'onCookTask': sharedserver info is invalid for name 'localscheduler/sharedsever0'

Traceback (most recent call last):
File "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.287/houdini/pdg/types\utils\commandchain.py", line 205, in onCookTask
raise pdg.CookError("sharedserver info is invalid for name '{}'".format(server_name))
CookError: sharedserver info is invalid for name 'localscheduler/sharedsever0'

I dont understand what is happening here. This happens even if the send command is blank.
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
There are particular RPC functions that 'sendcommand' expects to be available to execute the script. You should base your server on the implementation in $HHP/pdgjob/genericrpc.py, which is what is used by the other command chains.

For example you can run

python.exe $HHP/pdgjob/genericrpc.py --start --host 0.0.0.0 --port 59902 --log c:/temp/myserver.log

To start a python command chain server that can be connected to.
Edited by chrisgreb - Dec. 13, 2020 10:32:35
User Avatar
Member
8 posts
Joined: Dec. 2014
Offline
Hi Chris, thanks I had a go at running the genericrpc.py and I was getting the same error.

BUT

Ive had a second think about why im even using a command chain. I can set up my own server and run functions using xmlrpc in plain old "python script" top nodes which seems to be working.
  • Quick Links