ConfigurationClient

class DIRAC.ConfigurationSystem.Client.ConfigurationClient.CSJSONClient(serviceName, **kwargs)

Bases: TornadoClient

The specific Tornado client for configuration system. To avoid JSON limitation the HTTPS handler encode data in base64 before sending them, this class only decode the base64

An exception is made with CommitNewData which ENCODE in base64

KW_DELEGATED_DN = 'delegatedDN'
KW_DELEGATED_GROUP = 'delegatedGroup'
KW_EXTRA_CREDENTIALS = 'extraCredentials'
KW_IGNORE_GATEWAYS = 'ignoreGateways'
KW_KEEP_ALIVE_LAPSE = 'keepAliveLapse'
KW_PROXY_CHAIN = 'proxyChain'
KW_PROXY_LOCATION = 'proxyLocation'
KW_PROXY_STRING = 'proxyString'
KW_SETUP = 'setup'
KW_SKIP_CA_CHECK = 'skipCACheck'
KW_TIMEOUT = 'timeout'
KW_USE_ACCESS_TOKEN = 'useAccessToken'
KW_USE_CERTIFICATES = 'useCertificates'
KW_VO = 'VO'
VAL_EXTRA_CREDENTIALS_HOST = 'hosts'
__init__(serviceName, **kwargs)
Parameters:
  • serviceName – URL of the service (proper uri or just System/Component)

  • useCertificates – If set to True, use the server certificate

  • extraCredentials

  • timeout – Timeout of the call (default 600 s)

  • setup – Specify the Setup

  • VO – Specify the VO

  • delegatedDN – Not clear what it can be used for.

  • delegatedGroup – Not clear what it can be used for.

  • ignoreGateways – Ignore the DIRAC Gatways settings

  • proxyLocation – Specify the location of the proxy

  • proxyString – Specify the proxy string

  • proxyChain – Specify the proxy chain

  • skipCACheck – Do not check the CA

  • keepAliveLapse – Duration for keepAliveLapse (heartbeat like) (now managed by requests)

commitNewData(sData)

Transmit request to service by encoding data in base64.

Parameters:

sData – Data to commit, you may call this method with CSAPI and Modificator

executeRPC(method, *args)

Calls a remote service

Parameters:
  • method (str) – remote procedure name

  • args – list of arguments

Returns:

decoded response from server, server may return S_OK or S_ERROR

getCompressedData()

Transmit request to service and get data in base64, it decode base64 before returning

Returns:

Configuration data, compressed

Return type:

str

getCompressedDataIfNewer(sClientVersion)

Transmit request to service and get data in base64, it decode base64 before returning.

Returns:

Configuration data, if changed, compressed

getDestinationService()

Returns the url the service.

getServiceName()

Returns the name of the service, if you had given a url at init, returns the URL.

receiveFile(destFile, *args)

Equivalent of receiveFile()

In practice, it calls the remote method streamToClient and stores the raw result in a file

Parameters:
  • destFile – file (or path) where to store the result

  • args – list of arguments

Returns:

S_OK/S_ERROR

sendFile(filename, fileID)

Equivalent of sendFile()

In practice, it calls the remote method streamFromClient and transfers the file as a string type value

Parameters:
  • filename (str) – file (or path) where to store the result

  • fileID (any) – tuple if file identifiers

Returns:

S_OK/S_ERROR result of the remote RPC call

class DIRAC.ConfigurationSystem.Client.ConfigurationClient.ConfigurationClient(**kwargs)

Bases: Client

Specific client to speak with ConfigurationServer.

This class must contain at least the JSON decoder dedicated to the Configuration Server.

You can implement more logic or function to the client here if needed, RPCCall can be made inside this class with executeRPC method.

__init__(**kwargs)

C’tor.

Parameters:

kwargs – just stored as an attribute and passed when creating the RPCClient

property call

To be removed once we’re sure self.call has been removed

Type:

Deprecated

executeRPC(*parms, **kws)

This method extracts some parameters from kwargs that are used as parameter of the constructor or RPCClient. Unfortunately, only a few of all the available parameters of BaseClient are exposed.

Parameters:
  • rpc – if an RPC client is passed, use that one

  • timeout – we can change the timeout on a per call bases. Default is self.timeout

  • url – We can specify which url to use

getClientKWArgs()

Returns a copy of the connection arguments

getServer()

Getter for the server url. Useful ?

httpsClient

alias of CSJSONClient

setServer(url)

Set the server URL used by default

Parameters:

url – url of the service