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: 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 = MetaData()
name
plotname
plottype
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
result
toList()

Simply returns a list of column values

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

Bases: 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 = MetaData()
name
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
severity
startdate
toList()

Simply returns a list of column values

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

Bases: 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 = MetaData()
opentickets
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
tickets
toList()

Simply returns a list of column values

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

Bases: 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 = MetaData()
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
site
status
toList()

Simply returns a list of column values

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

Bases: 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 = MetaData()
pilotjobeff
pilotsperjob
registry: RegistryType = <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: 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 = MetaData()
name
policyname
reason
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
status
statustype
toList()

Simply returns a list of column values

vo
class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.ResourceManagementDB(parentLogger=None)

Bases: SQLAlchemyDB

Class that defines the methods to interact to the ResourceManagementDB tables

__init__(parentLogger=None)

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: 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 = MetaData()
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
toList()

Simply returns a list of column values

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

Bases: 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 = MetaData()
metric
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
sourcename
toList()

Simply returns a list of column values

value