ServiceInterface
This module exposes singleton gServiceInterface as istance of ServiceInterface (also in this module)
Interacts with RRD (rrdtool), with ComponentMonitoringDB (mysql) and with MonitoringCatalog (sqlite3)
Main clients are the monitoring handler (what’s called by gMonitor object), and the web portal.
- class DIRAC.FrameworkSystem.private.monitoring.ServiceInterface.ServiceInterface
Bases:
object
The gServiceInterface singleton object which is used by the MonitoringHandle to register activities and commit the data is inherited from this class.
- __init__()
- commitMarks(sourceId, activitiesDict, componentExtraInfo)
Adds marks to activities.
- Parameters
sourceId (int) – This id is returned after the activity is registered inside the database and is used for committing the marks.
activitiesDict (dictionary) – The activity dictionary containing information about ‘category’, ‘description’, ‘bucketLength’, ‘type’, ‘unit’
componentExtraInfo (dictionary) – This contains one or many of these ‘version’, ‘DIRACVersion’, ‘description’, ‘startTime’, ‘platform’, ‘cycles’, ‘queries’.
- Returns
S_OK with a list of unregistered activities.
- deleteActivity(sourceId, activityId)
Deletes a view.
- Parameters
sourceId (string) – The source id.
activityId (string) – The activity id.
- Returns
S_OK / The corresponding error message.
- deleteView(viewId)
Deletes a view.
- Parameters
viewId (string) – The view id.
- Returns
S_OK
- fieldValue(field, definedFields)
Calculated values for a field given a set of defined values for other fields.
- generatePlots(fromSecs, toSecs, viewDescription, size=1)
Generates plots for a view.
- Parameters
- Returns
S_OK with a list of files.
- getActivities(dbCond={})
Gets a list of activities.
- Parameters
dbCond (dictionary) – The required database conditions.
- Returns
an activity dictionary.
- getActivitiesContents(selDict, sortList, start, limit)
Gets all the sources and activities details in a joined format.
- Parameters
- Returns
S_OK with a tuple of the result list and fields list.
- getComponentsStatus(condDict=False)
This method basically returns the component status by reading it from the ComponentMonitoringDB.
- Parameters
condDict (dictionary) – The dictionary containing the conditions.
- Returns
S_OK with the requires results.
- getGraphData(filename)
Reads the contents of a plot file.
- Parameters
filname – The name of the file.
- Returns
S_OK with all the data that is read.
- getNumberOfActivities(dbCond={})
Gets the number of activities.
- Parameters
dbCond (dictionary) – The required database conditions.
- Returns
An integer indicating the total number of activities.
- getSources(dbCond={}, fields=[])
Gets a list of activities.
- Parameters
dbCond (dictionary) – The required database conditions.
fields (list) – A list of required fields.
- Returns
The list of results after the query is performed.
- getViews(onlyStatic=True)
Gets all stored views.
- Parameters
onlyStatic (bool) – Whether the views required are static or not.
- Returns
S_OK with a list of views.
- initialize(dataPath)
Initializes monitoring server
- Parameters
dataPath (string) – The root path of the data directory.
- initializeDB()
Initializes and creates monitoring catalog db if it doesn’t exist
- plotView(viewRequest)
Generates all plots for a view.
- Parameters
viewRequest (dictionary) – Containing information of the view like ‘id’, ‘fromSecs’, ‘toSecs’, etc.
- Returns
S_OK with a list of files.
- registerActivities(sourceDict, activitiesDict, componentExtraInfo)
Registers new activities in the database.
- Parameters
sourceDict (dictionary) – The source dictionary containing information about “setup”, “site”, “componentType”, “componentLocation”, “componentName”
activitiesDict (dictionary) – The activity dictionary containing information about ‘category’, ‘description’, ‘bucketLength’, ‘type’, ‘unit’
componentExtraInfo (dictionary) – This contains one or many of these ‘version’, ‘DIRACVersion’, ‘description’, ‘startTime’, ‘platform’, ‘cycles’, ‘queries’.
- Returns
S_OK with sourceId / S_ERROR with the corresoponding message.
- saveView(viewName, viewDescription)
Saves a view in the catalog.
- Parameters
viewName (string) – Name of the view.
viewDescription (dictionary) – A dictionary containing the view description.
- Returns
S_OK / S_ERROR with the corresponding error message.