BundleDeliveryClient

Client for interacting with Framework/BundleDelivery service

class DIRAC.FrameworkSystem.Client.BundleDeliveryClient.BundleDeliveryClient(transferClient=False, **kwargs)

Bases: Client

__init__(transferClient=False, **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

getCAs()

This method can be used to create the CAs. If the file can not be created, it will be downloaded from the server.

Returns:

S_OK(str)/S_ERROR()

getCLRs()

This method can be used to create the CRLs. If the file can not be created, it will be downloaded from the server.

Returns:

S_OK(str)/S_ERROR()

getClientKWArgs()

Returns a copy of the connection arguments

getListOfBundles(cls, **kwargs)

Automatically created for the service function export_getListOfBundles()

getServer()

Getter for the server url. Useful ?

httpsClient

alias of TornadoClient

setServer(url)

Set the server URL used by default

Parameters:

url – url of the service

syncCAs()

Synchronize CAs

Returns:

S_OK(bool)/S_ERROR()

syncCRLs()

Synchronize CRLs

Returns:

S_OK(bool)/S_ERROR()

syncDir(bundleID, dirToSyncTo)

Synchronize directory

Parameters:
  • bundleID (str) – bundle ID

  • dirToSyncTo (str) – path to sync directory

Returns:

S_OK(bool)/S_ERROR()

class DIRAC.FrameworkSystem.Client.BundleDeliveryClient.BundleDeliveryJSONClient(serviceName, **kwargs)

Bases: TornadoClient

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)

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

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(buff, fileId)

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