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 RPCClientSelector or TransferClientSelector

In 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 an DIRAC.Core.Base.DISET.RPCClient.RPCClient

Params disetClient:

the DISET class to be instantiated, so either DIRAC.Core.Base.DISET.RPCClient.RPCClient or DIRAC.Core.Base.DISET.TransferClient.TransferClient

Parameters:
  • args – Whatever disetClient takes 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 disetClient takes.

    • 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 RPCClientSelector or TransferClientSelector

In 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 an DIRAC.Core.Base.DISET.RPCClient.RPCClient

Params disetClient:

the DISET class to be instantiated, so either DIRAC.Core.Base.DISET.RPCClient.RPCClient or DIRAC.Core.Base.DISET.TransferClient.TransferClient

Parameters:
  • args – Whatever disetClient takes 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 disetClient takes.

    • 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 RPCClientSelector or TransferClientSelector

In 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 an DIRAC.Core.Base.DISET.RPCClient.RPCClient

Params disetClient:

the DISET class to be instantiated, so either DIRAC.Core.Base.DISET.RPCClient.RPCClient or DIRAC.Core.Base.DISET.TransferClient.TransferClient

Parameters:
  • args – Whatever disetClient takes 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 disetClient takes.

    • httpsClient: specific class inheriting from TornadoClient