ReqClient

mod:ReqClient
class DIRAC.RequestManagementSystem.Client.ReqClient.ReqClient(url=None, **kwargs)

Bases: DIRAC.Core.Base.Client.Client

ReqClient is a class manipulating and operation on Requests.

Parameters:
  • requestManager (RPCClient) – RPC client to RequestManager
  • requestProxiesDict (dict) – RPC client to ReqestProxy
  • requestValidator (RequestValidator) – RequestValidator instance
__init__(url=None, **kwargs)

c’tor

Parameters:
  • self – self reference
  • url – url of the ReqManager
  • kwargs – forwarded to the Base Client class
cancelRequest(cls, requestID, **kwargs)

Cancel a request

Automatically created for the service function export_cancelRequest()

Parameters:requestID – requestID
deleteRequest(requestID)

delete request given it’s ID

Parameters:
  • self – self reference
  • requestID (str) – request ID
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
finalizeRequest(requestID, jobID, useCertificates=True)
check request status and perform finalization if necessary
update the request status and the corresponding job parameter
Parameters:
  • self – self reference
  • requestID (str) – request id
  • jobID (int) – job id
getBulkRequests(**kwargs)

get bulk requests from RequestDB

Parameters:
  • self – self reference
  • numberOfRequest (str) – size of the bulk (default 10)
Returns:

S_OK( Successful : { requestID, RequestInstance }, Failed : message ) or S_ERROR

getDBSummary()

Get the summary of requests in the RequestDBs.

getDigest(requestID)

Get the request digest given a request ID.

Parameters:
  • self – self reference
  • requestID (str) – request id
getDistinctValuesWeb(cls, attribute, **kwargs)

Get distinct values for a given request attribute. ‘Type’ is interpreted as the operation type

Automatically created for the service function export_getDistinctValuesWeb()

Parameters:attribute – attribute
getRequest(requestID=0)

Get request from RequestDB

Parameters:
  • self – self reference
  • requestID (int) – ID of the request. If 0, choice is made for you
Returns:

S_OK( Request instance ) or S_OK() or S_ERROR

getRequestCountersWeb(cls, groupingAttribute, selectDict, **kwargs)

For the web portal. Returns a dictionary {value : counts} for a given key. The key can be any field from the RequestTable. or “Type”, which will be interpreted as ‘Operation.Type’

Parameters:
  • groupingAttribute – attribute used for grouping
  • selectDict – selection criteria

Automatically created for the service function export_getRequestCountersWeb()

getRequestFileStatus(requestID, lfns)

Get file status for request given a request id.

Parameters:
  • self – self reference
  • requestID (int) – request id
  • lfns (list) – list of LFNs
getRequestIDForName(cls, requestName, **kwargs)

get requestID for given :requestName:

Automatically created for the service function export_getRequestIDForName()

Parameters:requestName – requestName
getRequestIDsForJobs(jobIDs)

get the request ids for the supplied jobIDs.

Parameters:
  • self – self reference
  • jobIDs (list) – list of job IDs (integers)
Returns:

S_ERROR or S_OK( “Successful”: { jobID1: reqID1, jobID2: requID2, … }, “Failed” : { jobIDn: errMsg, jobIDm: errMsg, …} )

getRequestIDsList(statusList=None, limit=None, since=None, until=None, getJobID=False)

get at most :limit: request ids with statuses in :statusList:

getRequestInfo(requestID)

The the request info given a request id.

Parameters:
  • self – self reference
  • requestID (int) – request nid
getRequestStatus(requestID)

Get the request status given a request id.

Parameters:
  • self – self reference
  • requestID (int) – id of the request
getRequestSummaryWeb(cls, selectDict, sortList, startItem, maxItems, **kwargs)

Returns a list of Request for the web portal

Parameters:
  • selectDict (dict) – parameter on which to restrain the query {key : Value} key can be any of the Request columns, ‘Type’ (interpreted as Operation.Type) and ‘FromData’ and ‘ToData’ are matched against the LastUpdate field
  • sortList (list) – [sorting column, ASC/DESC]
  • startItem (int) – start item (for pagination)
  • maxItems (int) – max items (for pagination)

Automatically created for the service function export_getRequestSummaryWeb()

getScheduledRequest(operationID)

get scheduled request given its scheduled OperationID

getServer()

Getter for the server url. Useful ?

peekRequest(requestID)

peek request

putRequest(request, useFailoverProxy=True, retryMainService=0)

Put request to RequestManager

Parameters:
  • self – self reference
  • request (Request) – Request instance
  • useFailoverProxy (bool) – if False, will not attempt to forward the request to ReqProxies
  • retryMainService (int) – Amount of time we retry on the main ReqHandler in case of failures
Returns:

S_OK/S_ERROR

readRequestsForJobs(**kwargs)

read requests for jobs

Parameters:jobIDs (list) – list with jobIDs
Returns:S_OK( { “Successful” : { jobID1 : Request, … }, “Failed” : { jobIDn : “Fail reason” } } )
requestProxies(timeout=120)

get request proxies dict

requestValidator()

get request validator

resetFailedRequest(requestID, allR=False)

Reset a failed request to “Waiting” status

setServer(url)

Set the server URL used by default

Parameters:url – url of the service
setTimeout(**kwargs)

Specify the timeout of the call. Forwarded to RPCClient

param int timeout:
 timeout for the RPC calls

Deprecated: Please use self._getRPC(timeout) or self.timeout=<value>

DIRAC.RequestManagementSystem.Client.ReqClient.prettyPrint(mainItem, key='', offset=0)
DIRAC.RequestManagementSystem.Client.ReqClient.printFTSJobs(request)

Prints the FTSJobs associated to a request

Parameters:request – Request object
DIRAC.RequestManagementSystem.Client.ReqClient.printFile(indexFile)
DIRAC.RequestManagementSystem.Client.ReqClient.printOperation(indexOperation, verbose=True, onlyFailed=False)
DIRAC.RequestManagementSystem.Client.ReqClient.printRequest(request, status=None, full=False, verbose=True, terse=False)
DIRAC.RequestManagementSystem.Client.ReqClient.recoverableRequest(request)