ResourceStatusClient

ResourceStatusClient

Client to interact with the ResourceStatusDB.

class DIRAC.ResourceStatusSystem.Client.ResourceStatusClient.ResourceStatusClient(**kwargs)

Bases: DIRAC.Core.Base.Client.Client

The ResourceStatusClient class exposes the DIRAC.ResourceStatus API. All functions you need are on this client.

You can use this client on this way

>>> from DIRAC.ResourceStatusSystem.Client.ResourceStatusClient import ResourceStatusClient
>>> rsClient = ResourceStatusClient()
__init__(**kwargs)

C’tor.

Parameters:kwargs – just stored as an attribute and passed when creating the RPCClient
addIfNotThereStatusElement(element, tableType, name=None, statusType=None, status=None, elementType=None, reason=None, dateEffective=None, lastCheckTime=None, tokenOwner=None, tokenExpiration=None)

Adds if-not-duplicated from <element><tableType> and also adds a log if flag is active.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - string

name of the individual of class element

statusType - string

it has to be a valid status type for the element class

status - string

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - string

column to distinguish between the different elements in the same element table.

reason - string

decision that triggered the assigned status

dateEffective - datetime

time-stamp from which the status & status type are effective

lastCheckTime - datetime

time-stamp setting last time the status & status were checked

tokenOwner - string

token assigned to the site & status type

tokenExpiration - datetime

time-stamp setting validity of token ownership

Returns:

S_OK() || S_ERROR()

addOrModifyStatusElement(element, tableType, name=None, statusType=None, status=None, elementType=None, reason=None, dateEffective=None, lastCheckTime=None, tokenOwner=None, tokenExpiration=None)

Adds or updates-if-duplicated from <element><tableType> and also adds a log if flag is active.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - string

name of the individual of class element

statusType - string

it has to be a valid status type for the element class

status - string

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - string

column to distinguish between the different elements in the same element table.

reason - string

decision that triggered the assigned status

dateEffective - datetime

time-stamp from which the status & status type are effective

lastCheckTime - datetime

time-stamp setting last time the status & status were checked

tokenOwner - string

token assigned to the site & status type

tokenExpiration - datetime

time-stamp setting validity of token ownership

Returns:

S_OK() || S_ERROR()

deleteStatusElement(element, tableType, name=None, statusType=None, status=None, elementType=None, reason=None, dateEffective=None, lastCheckTime=None, tokenOwner=None, tokenExpiration=None, meta=None)

Deletes from <element><tableType> all rows that match the parameters given.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - [, string, list]

name of the individual of class element

statusType - [, string, list]

it has to be a valid status type for the element class

status - [, string, list]

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - [, string, list]

column to distinguish between the different elements in the same element table.

reason - [, string, list]

decision that triggered the assigned status

dateEffective - [, datetime, list]

time-stamp from which the status & status type are effective

lastCheckTime - [, datetime, list]

time-stamp setting last time the status & status were checked

tokenOwner - [, string, list]

token assigned to the site & status type

tokenExpiration - [, datetime, list]

time-stamp setting validity of token ownership

meta - dict

metadata for the mysql query

Returns:

S_OK() || S_ERROR()

executeRPC(*parms, **kws)

This method extracts some parameters from kwargs that are used as parameter of the constructor or RPCClient. Unfortunately, only a few of all the available parameters of BaseClient are exposed.

Parameters:
  • rpc – if an RPC client is passed, use that one
  • timeout – we can change the timeout on a per call bases. Default 120 s
  • url – We can specify which url to use
getServer()

Getter for the server url. Useful ?

insertStatusElement(element, tableType, name, statusType, status, elementType, reason, dateEffective, lastCheckTime, tokenOwner, tokenExpiration=None)

Inserts on <element><tableType> a new row with the arguments given.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - string

name of the individual of class element

statusType - string

it has to be a valid status type for the element class

status - string

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - string

column to distinguish between the different elements in the same element table.

reason - string

decision that triggered the assigned status

dateEffective - datetime

time-stamp from which the status & status type are effective

lastCheckTime - datetime

time-stamp setting last time the status & status were checked

tokenOwner - string

token assigned to the site & status type

tokenExpiration - datetime

time-stamp setting validity of token ownership

Returns:

S_OK() || S_ERROR()

modifyStatusElement(element, tableType, name=None, statusType=None, status=None, elementType=None, reason=None, dateEffective=None, lastCheckTime=None, tokenOwner=None, tokenExpiration=None)

Updates from <element><tableType> and also adds a log if flag is active.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - string

name of the individual of class element

statusType - string

it has to be a valid status type for the element class

status - string

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - string

column to distinguish between the different elements in the same element table.

reason - string

decision that triggered the assigned status

dateEffective - datetime

time-stamp from which the status & status type are effective

lastCheckTime - datetime

time-stamp setting last time the status & status were checked

tokenOwner - string

token assigned to the site & status type

tokenExpiration - datetime

time-stamp setting validity of token ownership

Returns:

S_OK() || S_ERROR()

notify(request, params)

Send notification for a given request with its params to the diracAdmin

selectStatusElement(element, tableType, name=None, statusType=None, status=None, elementType=None, reason=None, dateEffective=None, lastCheckTime=None, tokenOwner=None, tokenExpiration=None, meta=None)

Gets from <element><tableType> all rows that match the parameters given.

Parameters:
element - string

it has to be a valid element ( ValidElement ), any of the defaults: Site | Resource | Node

tableType - string

it has to be a valid tableType [ ‘Status’, ‘Log’, ‘History’ ]

name - [, string, list]

name of the individual of class element

statusType - [, string, list]

it has to be a valid status type for the element class

status - [, string, list]

it has to be a valid status, any of the defaults: Active | Degraded | Probing | Banned

elementType - [, string, list]

column to distinguish between the different elements in the same element table.

reason - [, string, list]

decision that triggered the assigned status

dateEffective - [, datetime, list]

time-stamp from which the status & status type are effective

lastCheckTime - [, datetime, list]

time-stamp setting last time the status & status were checked

tokenOwner - [, string, list]

token assigned to the site & status type

tokenExpiration - [, datetime, list]

time-stamp setting validity of token ownership

meta - dict

metadata for the mysql query. Currently it is being used only for column selection. For example: meta = { ‘columns’ : [ ‘Name’ ] } will return only the ‘Name’ column.

Returns:

S_OK() || S_ERROR()

setServer(url)

Set the server URL used by default

Parameters:url – url of the service
setTimeout(timeout)

Specify the timeout of the call. Forwarded to RPCClient

Parameters:timeout – guess…