ResourceStatusHandler

ResourceStatusHandler

Module that allows users to access the ResourceStatusDB remotely.

class DIRAC.ResourceStatusSystem.Service.ResourceStatusHandler.ResourceStatusHandler(*args, **kwargs)

Bases: DIRAC.Core.DISET.RequestHandler.RequestHandler

The ResourceStatusHandler exposes the DB front-end functions through a XML-RPC server, functionalities inherited from DIRAC.Core.DISET.RequestHandler.RequestHandler

According to the ResourceStatusDB philosophy, only functions of the type: - insert - update - select - delete

are exposed. If you need anything more complicated, either look for it on the ResourceStatusClient, or code it yourself. This way the DB and the Service are kept clean and tidied.

To can use this service on this way, but you MUST NOT DO IT. Use it through the ResourceStatusClient. If offers in the worst case as good performance as the ResourceStatusHandler, if not better.

>>> from DIRAC.Core.DISET.RPCClient import RPCCLient
>>> server = RPCCLient( "ResourceStatus/ResourceStatus" )
exception ConnectionError(msg)

Bases: exceptions.Exception

__init__(msg)

x.__init__(…) initializes x; see help(type(x)) for signature

args
message
__init__(*args, **kwargs)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service
  • trid (object) – Transport to use
auth_ping = ['all']
auth_refreshConfiguration = ['CSAdministrator']
export_addIfNotThere(table, params)

This method is a bridge to access ResourceStatusDB remotely. It does not add neither processing nor validation. If you need to know more about this method, you must keep reading on the database documentation.

Parameters:
table - string or dict

should contain the table from which querying if it’s a dict the query comes from a client prior to v6r18

params - dict

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

export_addOrModify(table, params)

This method is a bridge to access ResourceStatusDB remotely. It does not add neither processing nor validation. If you need to know more about this method, you must keep reading on the database documentation.

Parameters:
table - string or dict

should contain the table from which querying if it’s a dict the query comes from a client prior to v6r18

params - dict

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

export_delete(table, params)

This method is a bridge to access ResourceStatusDB remotely. It does not add neither processing nor validation. If you need to know more about this method, you must keep reading on the database documentation.

Parameters:
table - string or dict

should contain the table from which querying if it’s a dict the query comes from a client prior to v6r18

params - dict

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

static export_echo(data)

This method is used for testing performance of the service

Parameters:data (str) – data to be sent back to the caller
Returns:S_OK, Value is the input data
export_insert(table, params)

This method is a bridge to access ResourceStatusDB remotely. It does not add neither processing nor validation. If you need to know more about this method, you must keep reading on the database documentation.

Parameters:
table - string or dict

should contain the table from which querying if it’s a dict the query comes from a client prior to v6r18

params - dict

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

export_ping()
static export_refreshConfiguration(fromMaster)

Force refreshing the configuration data

Parameters:fromMaster (bool) – flag to refresh from the master configuration service
export_select(table, params)

This method is a bridge to access ResourceStatusDB remotely. It does not add neither processing nor validation. If you need to know more about this method, you must keep reading on the database documentation.

Parameters:
table - string or dict

should contain the table from which querying if it’s a dict the query comes from a client prior to v6r18

params - dict

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

classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
initialize()

Initialize this instance of the handler (to be overwritten)

static setDatabase(database)

This method let us inherit from this class and overwrite the database object without having problems with the global variables.

Parameters:
database - MySQL

database used by this handler

Returns:

None

srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:Value for serviceSection/optionName in the CS being defaultValue the default
srv_getClientSetup()
srv_getClientVO()
srv_getClientVersion()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:Address of remote peer.
srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:Credentials dictionary of remote peer.
classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
transfer_bulkFromClient(bulkId, token, bulkSize, fileHelper)
transfer_bulkToClient(bulkId, token, fileHelper)
transfer_fromClient(fileId, token, fileSize, fileHelper)
transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileId, token, fileHelper)
types_addIfNotThere = [[<type 'basestring'>, <type 'dict'>], <type 'dict'>]
types_addOrModify = [[<type 'basestring'>, <type 'dict'>], <type 'dict'>]
types_delete = [[<type 'basestring'>, <type 'dict'>], <type 'dict'>]
types_echo = [<type 'basestring'>]
types_insert = [[<type 'basestring'>, <type 'dict'>], <type 'dict'>]
types_ping = []
types_refreshConfiguration = [<type 'bool'>]
types_select = [[<type 'basestring'>, <type 'dict'>], <type 'dict'>]
DIRAC.ResourceStatusSystem.Service.ResourceStatusHandler.convert(table, params)

Conversion utility for backward compatibility

DIRAC.ResourceStatusSystem.Service.ResourceStatusHandler.initializeResourceStatusHandler(serviceInfo)
Handler initialization, where we:

dynamically load ResourceStatus database plugin module, as advised by the config, (assumes that the module name and a class name are the same) set the ResourceManagementDB as global db.

param serviceInfo:
 service info dictionary
return:standard Dirac return object
DIRAC.ResourceStatusSystem.Service.ResourceStatusHandler.loadResourceStatusComponent(moduleName, className)

Create an object of a given database component.

Parameters:
  • moduleName – module name to be loaded
  • className – class name
Returns:

object instance wrapped in a standard Dirac return object.