RPCClient

RPCClient object is used to create RPC connection to services

class DIRAC.Core.DISET.RPCClient.RPCClient(*args, **kwargs)

Bases: object

This class contains the mechanism to convert normal calls to RPC calls. When instanciated, it creates a ~DIRAC.Core.DISET.private.InnerRPCClient.InnerRPCClient as an attribute. Any attribute which is accessed is then either redirected to InnerRPCClient if it has it, or creates a MagicMethod object otherwise. If the attribute is a function, MagicMethod will trigger the RPC call, using the InnerRPCClient.

The typical workflow looks like this:

rpc = RPCClient('DataManagement/FileCatalog')

# Here, func is the ping function, which we call remotely.
# We go through RPCClient.__getattr__ which returns us a MagicMethod object
func = rpc.ping

# Here we call the method __call__ of the MagicMethod
func()
__init__(*args, **kwargs)

Constructor The arguments are just passed on to InnerRPCClient. In practice:

  • args: has to be the service name or URL
  • kwargs: all the arguments InnerRPCClient and BaseClient accept as configuration
DIRAC.Core.DISET.RPCClient.executeRPCStub(rpcStub)

Playback a stub