ClientSelector
This modules defines two functions that can be used in place of the RPCClient and
TransferClient to transparently switch to https.
Example:
from DIRAC.Core.Tornado.Client.ClientSelector import RPCClientSelector as RPCClient
myService = RPCClient("Framework/MyService")
myService.doSomething()
- DIRAC.Core.Tornado.Client.ClientSelector.ClientSelector(disetClient, *args, **kwargs)
Select the correct Client (either RPC or Transfer ), instantiate it, and return it.
The selection is based on the URL:
either it contains the protocol, in which case we make a choice
or it is in the form <Component/Service>, in which case we resolve first
This is a generic function. You should rather use
RPCClientSelectororTransferClientSelectorIn principle, the only place for this class to be used is in
DIRAC.Core.Base.Client.Client, since it is the only one supposed to instantiate anDIRAC.Core.Base.DISET.RPCClient.RPCClient- Params disetClient:
the DISET class to be instantiated, so either
DIRAC.Core.Base.DISET.RPCClient.RPCClientorDIRAC.Core.Base.DISET.TransferClient.TransferClient- Parameters:
args – Whatever
disetClienttakes as args, but the first one is always the URL we want to rely on. It can be either “system/service” or “dips://domain:port/system/service”kwargs –
This can contain:
Whatever
disetClienttakes.httpsClient: specific class inheriting from TornadoClient
- DIRAC.Core.Tornado.Client.ClientSelector.RPCClientSelector(*args, **kwargs)
Select the correct Client (either RPC or Transfer ), instantiate it, and return it.
The selection is based on the URL:
either it contains the protocol, in which case we make a choice
or it is in the form <Component/Service>, in which case we resolve first
This is a generic function. You should rather use
RPCClientSelectororTransferClientSelectorIn principle, the only place for this class to be used is in
DIRAC.Core.Base.Client.Client, since it is the only one supposed to instantiate anDIRAC.Core.Base.DISET.RPCClient.RPCClient- Params disetClient:
the DISET class to be instantiated, so either
DIRAC.Core.Base.DISET.RPCClient.RPCClientorDIRAC.Core.Base.DISET.TransferClient.TransferClient- Parameters:
args – Whatever
disetClienttakes as args, but the first one is always the URL we want to rely on. It can be either “system/service” or “dips://domain:port/system/service”kwargs –
This can contain:
Whatever
disetClienttakes.httpsClient: specific class inheriting from TornadoClient
- DIRAC.Core.Tornado.Client.ClientSelector.TransferClientSelector(*args, **kwargs)
Select the correct Client (either RPC or Transfer ), instantiate it, and return it.
The selection is based on the URL:
either it contains the protocol, in which case we make a choice
or it is in the form <Component/Service>, in which case we resolve first
This is a generic function. You should rather use
RPCClientSelectororTransferClientSelectorIn principle, the only place for this class to be used is in
DIRAC.Core.Base.Client.Client, since it is the only one supposed to instantiate anDIRAC.Core.Base.DISET.RPCClient.RPCClient- Params disetClient:
the DISET class to be instantiated, so either
DIRAC.Core.Base.DISET.RPCClient.RPCClientorDIRAC.Core.Base.DISET.TransferClient.TransferClient- Parameters:
args – Whatever
disetClienttakes as args, but the first one is always the URL we want to rely on. It can be either “system/service” or “dips://domain:port/system/service”kwargs –
This can contain:
Whatever
disetClienttakes.httpsClient: specific class inheriting from TornadoClient