StorageElementHandler

mod:StorageElementHandler

The following methods are available in the Service interface

getMetadata() - get file metadata listDirectory() - get directory listing remove() - remove one file removeDirectory() - remove on directory recursively removeFileList() - remove files in the list getAdminInfo() - get administration information about the SE status getFreeDiskSpace() - get the free disk space getTotalDiskSpace() - get the free total space

The handler implements also the DISET data transfer calls toClient(), fromClient(), bulkToClient(), bulkFromClient which support single file, directory and file list upload and download

The class can be used as the basis for more advanced StorageElement implementations

class DIRAC.DataManagementSystem.Service.StorageElementHandler.StorageElementHandler(handlerInitDict, trid)

Bases: DIRAC.Core.DISET.RequestHandler.RequestHandler

class StorageElementHandler
exception ConnectionError(msg)

Bases: exceptions.Exception

__init__(msg)

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

args
message
__init__(handlerInitDict, trid)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service
  • trid (object) – Transport to use
auth_ping = ['all']
export_createDirectory(dir_path)

Creates the directory on the storage

static export_echo(data)

This method used for testing the performance of a service

export_exists(fileID)

Check existence of the fileID

static export_getAdminInfo()

Send the storage element administration information

export_getDirectorySize(fileID)

Get the size occupied by the given directory

static export_getFreeDiskSpace()

Get the free disk space of the storage element

Returns:S_OK/S_ERROR, Value is the free space on the SE storage in MB
export_getMetadata(fileID)

Get metadata for the file or directory specified by fileID

static export_getTotalDiskSpace()

Get the total disk space of the storage element

Returns:S_OK/S_ERROR, Value is the max total volume of the SE storage in MB
export_listDirectory(dir_path, mode)

Return the dir_path directory listing

export_ping()
export_remove(fileID, token)

Remove fileID from the storage. token is used for access rights confirmation.

export_removeDirectory(fileID, token)

Remove the given directory from the storage

export_removeFileList(fileList, token)

Remove files in the given list

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)

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_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(fileID, token, _ignoredSize, fileHelper)

Receive files packed into a tar archive by the fileHelper logic. token is used for access rights confirmation.

transfer_bulkToClient(fileId, token, fileHelper)

Send directories and files specified in the fileID. The fileID string can be a single directory name or a list of colon (:) separated file/directory names. token is used for access rights confirmation.

transfer_fromClient(fileID, token, fileSize, fileHelper)

Method to receive file from clients. fileID is the local file name in the SE. fileSize can be Xbytes or -1 if unknown. token is used for access rights confirmation.

transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileID, token, fileHelper)

Method to send files to clients. fileID is the local file name in the SE. token is used for access rights confirmation.

types_createDirectory = [<type 'basestring'>]
types_echo = [<type 'basestring'>]
types_exists = [<type 'basestring'>]
types_getAdminInfo = []
types_getDirectorySize = [<type 'basestring'>]
types_getFreeDiskSpace = []
types_getMetadata = [<type 'basestring'>]
types_getTotalDiskSpace = []
types_listDirectory = [<type 'basestring'>, <type 'basestring'>]
types_ping = []
types_remove = [<type 'basestring'>, <type 'basestring'>]
types_removeDirectory = [<type 'basestring'>, <type 'basestring'>]
types_removeFileList = [<type 'list'>, <type 'basestring'>]
DIRAC.DataManagementSystem.Service.StorageElementHandler.getDiskSpace(path, total=False)

Returns disk usage of the given path, in MB. If total is set to true, the total disk space will be returned instead.

DIRAC.DataManagementSystem.Service.StorageElementHandler.getFreeDiskSpace(ignoreMaxStorageSize=True)

Returns the free disk space still available for writing taking into account the total available disk space and the MAX_STORAGE_SIZE limitation

Returns:S_OK/S_ERROR, Value is the free space of the SE storage in MB
DIRAC.DataManagementSystem.Service.StorageElementHandler.getTotalDiskSpace()

Returns the total maximum volume of the SE storage in MB. The total volume can be limited either by the amount of the available disk space or by the MAX_STORAGE_SIZE value.

Returns:S_OK/S_ERROR, Value is the max total volume of the SE storage in MB
DIRAC.DataManagementSystem.Service.StorageElementHandler.initializeStorageElementHandler(serviceInfo)

Initialize Storage Element global settings