FTS3DB

Frontend to FTS3 MySQL DB. Written using sqlalchemy

class DIRAC.DataManagementSystem.DB.FTS3DB.FTS3DB

Bases: object

class RequestDB

db holding requests

__init__()

c’tor

Parameters:self – self reference
createTables()

create tables

deleteFinalOperations(limit=20, deleteDelay=180)

deletes operation in final state that are older than given time

Parameters:
  • limit (int) – number of operations to treat
  • deleteDelay (int) – age of the lastUpdate in days
Returns:

S_OK/S_ERROR with number of deleted operations

getActiveJobs(limit=20, lastMonitor=None, jobAssignmentTag='Assigned')
Get the FTSJobs that are not in a final state, and are not assigned for monitoring

or has its operation being treated

By assigning the job to the DB:
  • it cannot be monitored by another agent
  • the operation to which it belongs cannot be treated
Parameters:
  • limit – max number of Jobs to retrieve
  • lastMonitor – jobs monitored earlier than the given date
  • jobAssignmentTag – if not None, block the Job for other queries, and use it as a prefix for the value in the operation table
Returns:

list of FTS3Jobs

getNonFinishedOperations(limit=20, operationAssignmentTag='Assigned')

Get all the non assigned FTS3Operations that are not yet finished, so either Active or Processed. An operation won’t be picked if it is already assigned, or one of its job is.

Parameters:
  • limit – max number of operations to retrieve
  • operationAssignmentTag – if not None, block the operations for other queries, and use it as a prefix for the value in the operation table
Returns:

list of Operations

getOperation(operationID)

read request

This does not set the assignment flag
Parameters:operationID – ID of the FTS3Operation
kickStuckOperations(limit=20, kickDelay=2)
finds operations that have not been updated for more than a given
time but are still assigned and resets the assignment
Parameters:
  • limit (int) – number of operations to treat
  • kickDelay (int) – age of the lastUpdate in hours
Returns:

S_OK/S_ERROR with number of kicked operations

persistOperation(operation)
update or insert request into db
Also release the assignment tag
Parameters:operation – FTS3Operation instance
updateFileStatus(fileStatusDict)
Update the file ftsStatus and error
The update is only done if the file is not in a final state

:param fileStatusDict : { fileID : { status , error } }

updateJobStatus(jobStatusDict)
Update the job Status and error
The update is only done if the job is not in a final state The assignment flag is released

:param jobStatusDict : { jobID : { status , error, completeness } }