RequestDB

Frontend for ReqDB

mod:

RequestDB


synopsis:

db holding Requests

db holding Request, Operation and File

class DIRAC.RequestManagementSystem.DB.RequestDB.RequestDB(parentLogger=None)

Bases: object

class RequestDB

db holding requests

__init__(parentLogger=None)

c’tor

Parameters:

self – self reference

cancelRequest(requestID)
createTables()

create tables

deleteRequest(requestID)

delete request given its ID

Parameters:
  • requestID (str) – request.RequestID

  • connection (mixed) – connection to use if any

getBulkRequestStatus(requestIDs)

get requests statuses for given request IDs

getBulkRequests(numberOfRequest=10, assigned=True)

read as many requests as requested for execution

Parameters:
  • numberOfRequest (int) – Number of Request we want (default 10)

  • assigned (bool) – if True, the status of the selected requests are set to assign

Returns:

a dictionary of Request objects indexed on the RequestID

getDBSummary()

get db summary

getDigest(requestID)

get digest for request given its id

Parameters:

requestName (str) – request id

getDistinctValues(tableName, columnName)

For a given table and a given field, return the list of of distinct values in the DB

getRequest(reqID=0, assigned=True)

read request for execution

Parameters:

reqID – request’s ID (default 0) If 0, take a pseudo random one

getRequestCountersWeb(groupingAttribute, selectDict)

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’

getRequestFileStatus(requestID, lfnList)

get status for files in request given its id

A single status is returned by file, which corresponds to the most representative one. That is:

  • Failed: if it has failed in any of the operation

  • Scheduled: if it is Scheduled in any of the operation

  • Waiting: if the process is ongoing

  • Done: if everything was executed

Parameters:
  • requestID (str) – Request.RequestID

  • lfnList (list) – list of LFNs

getRequestIDForName(requestName)
read request id for given name

if the name is not unique, an error is returned

Parameters:

requestName – name of the request

getRequestIDsForJobs(jobIDs)

returns request ids for jobs given jobIDs

Parameters:

jobIDs (list) – list of jobIDs

Returns:

S_OK( “Successful” : { jobID1 : Request, jobID2: Request, … } “Failed” : { jobID3: “error message”, … } )

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

select requests with status in :statusList:

getRequestInfo(requestID)

get request info given Request.RequestID

getRequestStatus(requestID)

get request status for a given request ID

getRequestSummaryWeb(selectDict, sortList, startItem, maxItems)

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)

getScheduledRequest(operationID)
peekRequest(requestID)

get request (ro), no update on states

Parameters:

requestID – Request.RequestID

putRequest(request)

update or insert request into db

Parameters:

request (Request) – Request instance

readRequestsForJobs(jobIDs=None)

read request for jobs

Parameters:

jobIDs (list) – list of JobIDs

Returns:

S_OK( “Successful” : { jobID1 : Request, jobID2: Request, … } “Failed” : { jobID3: “error message”, … } )