GatewayService

The gateway service is used for forwarding service calls to the appropriate services.

For this to be used, the following CS option is required:

DIRAC
{
  Gateways
  {
    my.site.org = dips://thisIsAn.url.org:9159/Framework/Gateway
  }
}

At the same time, this same gateway service should be run with option /LocalInstallation/Site which is different from “my.site.org” or whatever is set in the option above, to avoid initialization loops.

class DIRAC.Core.DISET.private.GatewayService.GatewayService

Bases: Service

Inherits from Service so it can (and should) be run as a DIRAC service, but replaces several of the internal methods

GATEWAY_NAME = 'Framework/Gateway'
SVC_SECLOG_CLIENT = <DIRAC.FrameworkSystem.Client.SecurityLogClient.SecurityLogClient object>
SVC_VALID_ACTIONS = {'Connection': 'Message', 'FileTransfer': 'transfer', 'Message': 'msg', 'RPC': 'export'}
__init__()

Initialize like a real service

getConfig()
handleConnection(clientTransport)

This method may be called by ServiceReactor. The method stacks openened connection in a queue, another thread read this queue and handle connection.

Parameters:

clientTransport – Object which describes opened connection (PlainTransport or SSLTransport)

initialize()

This replaces the standard initialize from Service

setCloneProcessId(cloneId)
property wantsThrottle

Boolean property for if the service wants requests to stop being accepted

class DIRAC.Core.DISET.private.GatewayService.MessageForwarder(msgBroker)

Bases: object

__init__(msgBroker)
addClient(cliTrid, destination, clientInitParams, connectParams)
cliDisconnect(cliTrid)
msgFromClient(cliTrid, msgObj)
msgFromSrv(srvEndCli, msgObj)
class DIRAC.Core.DISET.private.GatewayService.TransferRelay(serviceName, **kwargs)

Bases: TransferClient

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_CERTIFICATES = 'useCertificates'
KW_VO = 'VO'
VAL_EXTRA_CREDENTIALS_HOST = 'hosts'
__init__(serviceName, **kwargs)

Constructor

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)

errMsg(msg, dynMsg='')
forwardBulkFromClient(clientFileHelper, params)
forwardBulkToClient(clientFileHelper, params)
forwardFromClient(clientFileHelper, params)
forwardListBulk(clientFileHelper, params)
forwardToClient(clientFileHelper, params)
getDataFromClient(clientFileHelper)
getDataFromService(srvMethod, params)
getDestinationService()

Return service destination

Returns:

str

getServiceName()

Return service name

Returns:

str

infoMsg(msg, dynMsg='')
listBulk(bulkId, token='', compress=True)

List the contents of a bulk

Parameters:
  • bulkId (any) – Identification of the bulk to list

  • token (string) – Token for the bulk

  • compress (boolean) – Enable compression for the bulk. By default its True

Returns:

S_OK/S_ERROR

receiveBulk(destDir, bulkId, token='', compress=True)

Receive a bulk of files from server

Parameters:
  • destDir (list of ( string / file descriptor / file object )) – Files to receive from server

  • bulkId (any) – Identification of the files being received

  • token (string) – Token for the bulk

  • compress (boolean) – Enable compression for the bulk. By default its True

Returns:

S_OK/S_ERROR

receiveFile(filename, fileId, token='')

Receive a file from the server

Parameters:
  • filename (string / file descriptor / file object) – File to receive from server

  • fileId (any) – Identification of the file being received

  • token (string) – Optional token for the file

Returns:

S_OK/S_ERROR

sendBulk(fileList, bulkId, token='', compress=True, bulkSize=-1, onthefly=True)

Send a bulk of files to server

Parameters:
  • fileList (list of ( string / file descriptor / file object )) – Files to send to server

  • bulkId (any) – Identification of the files being sent

  • token (string) – Token for the bulk

  • compress (boolean) – Enable compression for the bulk. By default its True

  • bulkSize (integer) – Optional size of the bulk

Returns:

S_OK/S_ERROR

sendDataToClient(clientFileHelper, dataToSend)
sendDataToService(srvMethod, params, data)
sendFile(filename, fileId, token='')

Send a file to server

Parameters:
  • filename (string / file descriptor / file object) – File to send to server

  • fileId (any) – Identification of the file being sent

  • token (string) – Optional token for the file

Returns:

S_OK/S_ERROR

setTransferLimit(trLimit)