LcgFileCatalogClient

Class for the LCG File Catalog Client

class DIRAC.Resources.Catalog.LcgFileCatalogClient.LcgFileCatalogClient(**options)

Bases: DIRAC.Resources.Catalog.FileCatalogClientBase.FileCatalogClientBase

ADMIN_METHODS = ['getUserDirectory', 'createUserDirectory', 'createUserMapping', 'removeUserDirectory']
NO_LFN_METHODS = ['getUserDirectory', 'createUserDirectory', 'createUserMapping', 'removeUserDirectory']
READ_METHODS = ['hasAccess', 'exists', 'getPathPermissions', 'isLink', 'readLink', 'isFile', 'getFileMetadata', 'getReplicas', 'getReplicaStatus', 'getFileSize', 'isDirectory', 'getDirectoryReplicas', 'listDirectory', 'getDirectoryMetadata', 'getDirectorySize', 'getDirectoryContents', 'resolveDataset', 'getLFNForPFN', 'getUserDirectory']
WRITE_METHODS = ['createLink', 'removeLink', 'addFile', 'addReplica', 'removeReplica', 'removeFile', 'setReplicaStatus', 'setReplicaHost', 'createDirectory', 'removeDirectory', 'removeDataset', 'removeFileFromDataset', 'createDataset', 'changePathOwner', 'changePathMode']
__init__(**options)

Constructor function.

addFile(lfns)
addReplica(lfns)

This adds a replica to the catalogue.

property call

To be removed once we’re sure self.call has been removed

Type

Deprecated

changePathMode(paths)

Change the ownership of the directory to the user associated to the supplied DN

changePathOwner(paths)

Change the ownership of the directory to the user associated to the supplied DN

createDataset(datasets)
createDirectory(lfns)
createUserDirectory(usernames)

Creates the user directory

createUserMapping(userDNs)

Create a user with the supplied DN and return the userID

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 is self.timeout

  • url – We can specify which url to use

exists(lfns)

Check if the path exists

getDirectoryMetadata(lfns)
getDirectoryReplicas(lfns, allStatus=False)

This method gets all of the pfns in the directory

getDirectorySize(lfns, longOutput=False, rawFiles=False)
getFileMetadata(lfns, ownership=False)

Returns the file metadata associated to a supplied LFN

getFileSize(lfns)

Get the size of a supplied file

classmethod getInterfaceMethods()

Get the methods implemented by the File Catalog client

Return tuple

( read_methods_list, write_methods_list, nolfn_methods_list )

getLFNForGUID(guids)
getLFNForPFN(pfns)
getName()
getPathPermissions(lfns)

Determine the VOMs based ACL information for a supplied path

getReplicaStatus(lfns)
getReplicas(lfns, allStatus=False)

Returns replicas for an LFN or list of LFNs

getServer()

Getter for the server url. Useful ?

getUserDirectory(usernames)

Takes a list of users and determines whether their directories already exist

hasAccess(lfns, opType)

Default method: returns True for all paths and all actions

Parameters
  • paths (lfn) – has to be formatted this way : { lfn : { se1 : pfn1, se2 : pfn2, …}, …}

  • _opType (str) – dummy string

Returns

{ successful : { lfn : [ ses ] } : failed : { lfn : { se : msg } } }

classmethod hasCatalogMethod(methodName)

Check of a method with the given name is implemented

Parameters

methodName (str) – the name of the method to check

Returns

boolean Flag True if the method is implemented

httpsClient

alias of DIRAC.Core.Tornado.Client.TornadoClient.TornadoClient

isDirectory(lfns)

Determine whether the path is a directory

isFile(lfns)
isOK()

Check that the service is OK

listDirectory(lfns, verbose=False)

Returns the result of __getDirectoryContents for multiple supplied paths

removeDataset(datasets)
removeDirectory(lfns, recursive=False)
removeFile(lfns)

Remove the supplied path

removeFileFromDataset(datasets)
removeReplica(lfns)
removeUserDirectory(username)

Remove the user directory and remove the user mapping

resolveDataset(datasets, allStatus=False)
setAuthorizationId(dn)

Set authorization id for the proxy-less LFC communication

setReplicaHost(lfns)

This modifies the replica metadata for the SE.

setReplicaProblematic(lfns, revert=False)

Set replicas to problematic.

Parameters
  • lfns (lfn) – has to be formated this way : { lfn : { se1 : pfn1, se2 : pfn2, …}, …}

  • revert – If True, remove the problematic flag

Returns

{ Successful : { lfn : [ ses ] }, Failed : { lfn : { se : msg } } }

setReplicaStatus(lfns)
setServer(url)

Set the server URL used by default

Parameters

url – url of the service

DIRAC.Resources.Catalog.LcgFileCatalogClient.addReplica(guid, pfn, se, master)
DIRAC.Resources.Catalog.LcgFileCatalogClient.addUserDN(userID, dn)
DIRAC.Resources.Catalog.LcgFileCatalogClient.closeDirectory(oDirectory)
DIRAC.Resources.Catalog.LcgFileCatalogClient.existsGuid(guid)

Check if the guid exists

DIRAC.Resources.Catalog.LcgFileCatalogClient.getClientCertInfo()
DIRAC.Resources.Catalog.LcgFileCatalogClient.getDNFromUID(userID)
DIRAC.Resources.Catalog.LcgFileCatalogClient.getDNUserID(dn)
DIRAC.Resources.Catalog.LcgFileCatalogClient.getRoleFromGID(groupID, path=None)
DIRAC.Resources.Catalog.LcgFileCatalogClient.modReplica(pfn, newse)
DIRAC.Resources.Catalog.LcgFileCatalogClient.removeReplica(pfn)
DIRAC.Resources.Catalog.LcgFileCatalogClient.returnCode(error, value='', errMsg='')
DIRAC.Resources.Catalog.LcgFileCatalogClient.setLfnReplicas(lfn, replicas, successful, failed)
DIRAC.Resources.Catalog.LcgFileCatalogClient.setReplicaStatus(pfn, status)