ResourceManagementDB

ResourceManagementDB: This module provides definition of the DB tables, and methods to access them.

Written using sqlalchemy declarative_base

For extending the ResourceStatusDB tables:

  1. In the extended module, call:

from DIRAC.ResourceStatusSystem.DB.ResourceManagementDB import rmsBase, TABLESLIST TABLESLIST = TABLESLIST + [list of new table names]

  1. provide a declarative_base definition of the tables (new or extended) in the extension module

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.AccountingCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

AccountingCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

dateeffective
fromDict(dictionary)

Fill the fields of the AccountingCache object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

lastchecktime
metadata = MetaData()
name
plotname
plottype
registry = <sqlalchemy.orm.decl_api.registry object>
result
toList()

Simply returns a list of column values

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.DowntimeCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

DowntimeCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

dateeffective
description
downtimeid
element
enddate
fromDict(dictionary)

Fill the fields of the DowntimeCache object from a dictionary

gocdbservicetype
lastchecktime
metadata = MetaData()
name
registry = <sqlalchemy.orm.decl_api.registry object>
severity
startdate
toList()

Simply returns a list of column values

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.GGUSTicketsCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

GGUSTicketsCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

fromDict(dictionary)

Fill the fields of the GGUSTicketsCache object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

gocsite
lastchecktime
metadata = MetaData()
opentickets
registry = <sqlalchemy.orm.decl_api.registry object>
tickets
toList()

Simply returns a list of column values

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.JobCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

JobCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

efficiency
fromDict(dictionary)

Fill the fields of the JobCache object from a dictionary

lastchecktime
maskstatus
metadata = MetaData()
registry = <sqlalchemy.orm.decl_api.registry object>
site
status
toList()

Simply returns a list of column values

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.PilotCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

PilotCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

ce
columnsOrder = ['Site', 'CE', 'Status', 'PilotJobEff', 'PilotsPerJob', 'LastCheckTime', 'VO']
fromDict(dictionary)

Fill the fields of the PilotCache object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

lastchecktime
metadata = MetaData()
pilotjobeff
pilotsperjob
registry = <sqlalchemy.orm.decl_api.registry object>
site
status
toList()

Simply returns a list of column values

vo
class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.PolicyResult(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

PolicyResult table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

dateeffective
element
fromDict(dictionary)

Fill the fields of the PolicyResult object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

lastchecktime
metadata = MetaData()
name
policyname
reason
registry = <sqlalchemy.orm.decl_api.registry object>
status
statustype
toList()

Simply returns a list of column values

vo
class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.ResourceManagementDB

Bases: DIRAC.Core.Base.SQLAlchemyDB.SQLAlchemyDB

Class that defines the methods to interact to the ResourceManagementDB tables

__init__()

c’tor

Parameters

self – self reference

addOrModify(table, params)

Using the PrimaryKeys of the table, it looks for the record in the database. If it is there, it is updated, if not, it is inserted as a new entry.

Parameters
  • table (str) – table where to add or modify

  • params (dict) – dictionary of what to add or modify

Returns

S_OK() || S_ERROR()

delete(table, params)
Parameters
  • table (str) – table from where to delete

  • params (dict) – dictionary of which line(s) to delete

Returns

S_OK() || S_ERROR()

getCSOption(optionName, defaultValue=None)
insert(table, params)

Inserts params in the DB.

Parameters
  • table (str) – table where to insert

  • params (dict) – Dictionary to fill a single line

Returns

S_OK() || S_ERROR()

select(table, params)

Uses params to build conditional SQL statement ( WHERE … ).

Parameters
params - dict

arguments for the mysql query ( must match table columns ! ).

Returns

S_OK() || S_ERROR()

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.SpaceTokenOccupancyCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

SpaceTokenOccupancyCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

endpoint
free
fromDict(dictionary)

Fill the fields of the SpaceTokenOccupancyCache object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

guaranteed
lastchecktime
metadata = MetaData()
registry = <sqlalchemy.orm.decl_api.registry object>
toList()

Simply returns a list of column values

token
total
class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.TransferCache(**kwargs)

Bases: sqlalchemy.orm.decl_api.Base

TransferCache table

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

destinationname
fromDict(dictionary)

Fill the fields of the TransferCache object from a dictionary

Parameters

dictionary – Dictionary to fill a single line

lastchecktime
metadata = MetaData()
metric
registry = <sqlalchemy.orm.decl_api.registry object>
sourcename
toList()

Simply returns a list of column values

value