ComponentMonitoringDB

ComponentMonitoring class is a front-end to the Component monitoring Database

class DIRAC.FrameworkSystem.DB.ComponentMonitoringDB.ComponentMonitoringDB(requireVoms=False, useMyProxy=False)

Bases: DIRAC.Core.Base.DB.DB

class ConnectionPool(host, user, passwd, port=3306, graceTime=600)

Bases: object

Management of connections per thread

__init__(host, user, passwd, port=3306, graceTime=600)

x.__init__(…) initializes x; see help(type(x)) for signature

clean(now=False)
get(dbName, retries=10)
transactionCommit(dbName)
transactionRollback(dbName)
transactionStart(dbName)
__init__(requireVoms=False, useMyProxy=False)

c’tor

Initialize the DB

buildCondition(condDict=None, older=None, newer=None, timeStamp=None, orderAttribute=None, limit=False, greater=None, smaller=None, offset=None)

Build SQL condition statement from provided condDict and other extra check on a specified time stamp. The conditions dictionary specifies for each attribute one or a List of possible values greater and smaller are dictionaries in which the keys are the names of the fields, that are requested to be >= or < than the corresponding value. For compatibility with current usage it uses Exceptions to exit in case of invalid arguments

countEntries(table, condDict, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)

Count the number of entries wit the given conditions

deleteEntries(tableName, condDict=None, limit=False, conn=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None)

Delete rows from “tableName” with N records can match the condition if limit is not False, the given limit is set String type values will be appropriately escaped, they can be single values or lists of values.

executeStoredProcedure(packageName, parameters, outputIds)
executeStoredProcedureWithCursor(packageName, parameters)
getCSOption(optionName, defaultValue=None)
getComponentsStatus(conditionDict={})

Get the status of the defined components in the CS compared to the ones that are known in the DB

Parameters:condDict (dictionary) – The dictionary containing the conditions.
Returns:S_OK with the requires results.
getCounters(table, attrList, condDict, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)

Count the number of records on each distinct combination of AttrList, selected with condition defined by condDict and time stamps

getDistinctAttributeValues(table, attribute, condDict=None, older=None, newer=None, timeStamp=None, connection=False, greater=None, smaller=None)

Get distinct values of a table attribute under specified conditions

getFields(tableName, outFields=None, condDict=None, limit=False, conn=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None)

Select “outFields” from “tableName” with condDict N records can match the condition return S_OK( tuple(Field,Value) ) if outFields is None all fields in “tableName” are returned if limit is not False, the given limit is set inValues are properly escaped using the _escape_string method, they can be single values or lists of values.

getOptionalFields()
heartbeat(compDict)

Updates the heartbeat

insertFields(tableName, inFields=None, inValues=None, conn=None, inDict=None)

Insert a new row in “tableName” assigning the values “inValues” to the fields “inFields”. String type values will be appropriately escaped.

registerComponent(compDict, shallow=False)

Register a new component in the DB given a component dictionary and returns a component id. And if it’s already registered it returns the corresponding component id.

transactionCommit()
transactionRollback()
transactionStart()
updateFields(tableName, updateFields=None, updateValues=None, condDict=None, limit=False, conn=None, updateDict=None, older=None, newer=None, timeStamp=None, orderAttribute=None, greater=None, smaller=None)

Update “updateFields” from “tableName” with “updateValues”. updateDict alternative way to provide the updateFields and updateValues N records can match the condition return S_OK( number of updated rows ) if limit is not False, the given limit is set String type values will be appropriately escaped.

class DIRAC.FrameworkSystem.DB.ComponentMonitoringDB.StatusSet(dbRecordsList=[])

This class is used to set component status as required and this method is used only by the ComponentMonitoringDB class.

__init__(dbRecordsList=[])
addUniqueToSet(setDict, compDict)

Adds unique components to a separate set.

Parameters:
  • setDict (dictionary) – The set dictionary.
  • compDict (dictionary) – The dictionary containing the component information.
getRequiredComponents()
setComponentsAsRequired(requiredSet)

Sets component details according to the required set.

Parameters:requiredSet (dictionary) – The required set dictionary.
setDBRecords(recordsList)

This sets the DB records given a records list.

Parameters:recordsList (list) – a set of records.
Returns:S_OK
walkSet(setDict, compDict, createMissing=True)

Updates the set dictionary.

Parameters:
  • setDict (dictionary) – The set dictionary.
  • compDict (dictionary) – The dictionary containing the component information.
  • createMissing – A variable for adding missing values.
Returns:

The set dictionary.