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.ext.declarative.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(bind=None)
name
plotname
plottype
result
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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(bind=None)
name
severity
startdate
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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(bind=None)
opentickets
tickets
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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(bind=None)
site
status
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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
fromDict(dictionary)

Fill the fields of the PilotCache object from a dictionary

Parameters:dictionary – Dictionary to fill a single line
lastchecktime
metadata = MetaData(bind=None)
pilotjobeff
pilotsperjob
site
status
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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(bind=None)
name
policyname
reason
status
statustype
toList()

Simply returns a list of column values

class DIRAC.ResourceStatusSystem.DB.ResourceManagementDB.ResourceManagementDB

Bases: object

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()

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.ext.declarative.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(bind=None)
toList()

Simply returns a list of column values

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

Bases: sqlalchemy.ext.declarative.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(bind=None)
metric
sourcename
toList()

Simply returns a list of column values

value