FileCatalogClient

The FileCatalogClient is a class representing the client of the DIRAC File Catalog

class DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient(url=None, **kwargs)

Bases: DIRAC.Resources.Catalog.FileCatalogClientBase.FileCatalogClientBase

Client code to the DIRAC File Catalogue

ADMIN_METHODS = ['addUser', 'deleteUser', 'addGroup', 'deleteGroup', 'getUsers', 'getGroups', 'getCatalogCounters', 'repairCatalog', 'rebuildDirectoryUsage']
NO_LFN_METHODS = ['findFilesByMetadata', 'addMetadataField', 'deleteMetadataField', 'getMetadataFields', 'setMetadata', 'setMetadataBulk', 'removeMetadata', 'getDirectoryUserMetadata', 'findDirectoriesByMetadata', 'getReplicasByMetadata', 'findFilesByMetadataDetailed', 'findFilesByMetadataWeb', 'getCompatibleMetadata', 'addMetadataSet', 'getMetadataSet', 'getFileUserMetadata', 'getLFNForGUID', 'addUser', 'deleteUser', 'addGroup', 'deleteGroup', 'repairCatalog', 'rebuildDirectoryUsage']
READ_METHODS = ['hasAccess', 'exists', 'getPathPermissions', 'isFile', 'getFileMetadata', 'getReplicas', 'getReplicaStatus', 'getFileSize', 'isDirectory', 'getDirectoryReplicas', 'listDirectory', 'getDirectoryMetadata', 'getDirectorySize', 'getDirectoryContents', 'getLFNForPFN', 'getLFNForGUID', 'findFilesByMetadata', 'getMetadataFields', 'findDirectoriesByMetadata', 'getReplicasByMetadata', 'findFilesByMetadataDetailed', 'findFilesByMetadataWeb', 'getCompatibleMetadata', 'getMetadataSet', 'getDatasets', 'getFileDescendents', 'getFileAncestors', 'getDirectoryUserMetadata', 'getFileUserMetadata', 'checkDataset', 'getDatasetParameters', 'getDatasetFiles', 'getDatasetAnnotation']
WRITE_METHODS = ['createLink', 'removeLink', 'addFile', 'setFileStatus', 'addReplica', 'removeReplica', 'removeFile', 'setReplicaStatus', 'setReplicaHost', 'setReplicaProblematic', 'createDirectory', 'setDirectoryStatus', 'removeDirectory', 'changePathMode', 'changePathOwner', 'changePathGroup', 'addMetadataField', 'deleteMetadataField', 'setMetadata', 'setMetadataBulk', 'removeMetadata', 'addMetadataSet', 'addDataset', 'addDatasetAnnotation', 'removeDataset', 'updateDataset', 'freezeDataset', 'releaseDataset', 'addUser', 'deleteUser', 'addGroup', 'deleteGroup', 'repairCatalog', 'rebuildDirectoryUsage']
addDataset(**kwargs)
addDatasetAnnotation(**kwargs)
addFile(**kwargs)
addFileAncestors(**kwargs)
addGroup(groupName, timeout=120)

Add a new group to the File Catalog

addMetadataField(fieldName, fieldType, metaType='-d', timeout=120)

Add a new metadata field of the given type

addMetadataSet(setName, setDict, timeout=120)

Add a new metadata set

addReplica(**kwargs)
addUser(userName, timeout=120)

Add a new user to the File Catalog

changePathGroup(**kwargs)
changePathMode(**kwargs)
changePathOwner(**kwargs)
checkDataset(**kwargs)
createDirectory(**kwargs)
deleteGroup(groupName, timeout=120)

Delete group from the File Catalog

deleteMetadataField(fieldName, timeout=120)

Delete the metadata field

deleteUser(userName, timeout=120)

Delete user from the File Catalog

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
exists(**kwargs)
findDirectoriesByMetadata(metaDict, path='/', timeout=120)

Find all the directories satisfying the given metadata set

findFilesByMetadata(metaDict, path='/', timeout=120)

Find files given the meta data query and the path

findFilesByMetadataDetailed(metaDict, path='/', timeout=120)

Find all the files satisfying the given metadata set

findFilesByMetadataWeb(metaDict, path, startItem, maxItems, timeout=120)

Find files satisfying the given metadata set

freezeDataset(**kwargs)
getCatalogCounters(timeout=120)

Get the number of registered directories, files and replicas in various tables

getCompatibleMetadata(metaDict, path='/', timeout=120)

Get metadata values compatible with the given metadata subset

getDatasetAnnotation(**kwargs)
getDatasetFiles(**kwargs)
getDatasetParameters(**kwargs)
getDatasets(**kwargs)
getDirectoryMetadata(**kwargs)
getDirectoryReplicas(**kwargs)
getDirectorySize(**kwargs)
getDirectoryUserMetadata(path, timeout=120)

Get all the metadata valid for the given directory path

getFileAncestors(**kwargs)
getFileDescendents(**kwargs)
getFileMetadata(**kwargs)
getFileSize(**kwargs)
getFileUserMetadata(path, timeout=120)

Get the meta data attached to a file, but also to the its corresponding directory

getGroups(timeout=120)

Get all the groups defined in the File Catalog

classmethod getInterfaceMethods()

Get the methods implemented by the File Catalog client

Return tuple:( read_methods_list, write_methods_list, nolfn_methods_list )
getLFNForGUID(guids, timeout=120)

Get the matching lfns for given guids

getMetadataFields(timeout=120)

Get all the metadata fields

getMetadataSet(setName, expandFlag, timeout=120)

Add a new metadata set

getPathPermissions(**kwargs)
getReplicaStatus(**kwargs)
getReplicas(**kwargs)
getReplicasByMetadata(metaDict, path='/', allStatus=False, timeout=120)

Find all the files satisfying the given metadata set

getServer()

Getter for the server url. Useful ?

getUsers(timeout=120)

Get all the users defined in the File Catalog

hasAccess(**kwargs)
classmethod hasCatalogMethod(methodName)

Check of a method with the given name is implemented :param str methodName: the name of the method to check :return: boolean Flag True if the method is implemented

isDirectory(**kwargs)
isFile(**kwargs)
isOK(timeout=120)

Check that the service is OK

listDirectory(**kwargs)
rebuildDirectoryUsage(timeout=120)

Rebuild DirectoryUsage table from scratch

releaseDataset(**kwargs)
removeDataset(**kwargs)
removeDirectory(**kwargs)
removeFile(**kwargs)
removeMetadata(pathMetadataDict, timeout=120)

Remove the specified metadata for the given path

removeReplica(**kwargs)
repairCatalog(timeout=120)

Repair the catalog inconsistencies

setFileStatus(**kwargs)
setMetadata(path, metadatadict, timeout=120)

Set metadata parameter for the given path

setMetadataBulk(pathMetadataDict, timeout=120)

Set metadata parameter for the given path

setReplicaHost(**kwargs)
setReplicaProblematic(**kwargs)
setReplicaStatus(**kwargs)
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…
updateDataset(**kwargs)