FileManagerPs

FileManager for … ?

class DIRAC.DataManagementSystem.DB.FileCatalogComponents.WithFkAndPs.FileManagerPs.FileManagerPs(database=None)

Bases: DIRAC.DataManagementSystem.DB.FileCatalogComponents.FileManagerBase.FileManagerBase

__init__(database=None)

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

addFile(lfns, credDict, connection=False)

Add files to the catalog

Parameters:lfns (dict) – dict{ lfn : info}. ‘info’ is a dict containing PFN, SE, Size and Checksum the SE parameter can be a list if we have several replicas to register
addFileAncestors(lfns, connection=False)

Add file ancestors to the catalog

addReplica(lfns, connection=False)

Add replica to the catalog

changeFileGroup(lfns)

Get set the group for the supplied files :param lfns : dictionary < lfn : group > :param int/str newGroup: optional new group/groupID the same for all the supplied lfns

changeFileMode(lfns)

” Set the mode for the supplied files :param lfns : dictionary < lfn : mode > :param int newMode: optional new mode the same for all the supplied lfns

changeFileOwner(lfns)

Set the owner for the supplied files :param lfns : dictionary < lfn : owner > :param int/str newOwner: optional new user/userID the same for all the supplied lfns

countFilesInDir(dirId)

Count how many files there is in a given Directory

:param dirID : directory id

Returns:S_OK(value) or S_ERROR
exists(lfns, connection=False)

Determine whether a file exists in the catalog

getDirectoryReplicas(dirID, path, allStatus=False, connection=False)

This is defined in the FileManagerBase but it relies on the SEManager to get the SE names. It is good practice in software, but since the SE and Replica tables are bound together in the DB, I might as well resolve the name in the query

Get the replicas for all the Files in the given Directory

Parameters:
  • dirID (int) – ID of the directory
  • path (unused) – useless
  • allStatus (bool) – whether all replicas and file status are considered If False, take the visibleFileStatus and visibleReplicaStatus values from the configuration
getFileAncestors(lfns, depths, connection=False)
getFileCounters(connection=False)

Get a number of counters to verify the sanity of the Files in the catalog

getFileDescendents(lfns, depths, connection=False)
getFileIDsInDirectory(dirID, requestString=False)
Get a list of IDs for all the files stored in given directories or their
subdirectories
Parameters:
  • dirID (int or list[int]) – single directory ID or a list of directory IDs
  • requestString (bool) – if True return result as a SQL SELECT string
Returns:

list of file IDs or SELECT string

getFileMetadata(lfns, connection=False)

Get file metadata from the catalog

getFileSize(lfns, connection=False)

Get file size from the catalog

getFilesInDirectory(dirID, verbose=False, connection=False)
getLFNForGUID(guids, connection=False)

Returns the lfns matching given guids

getPathPermissions(paths, credDict, connection=False)

Get the permissions for the supplied paths

getReplicaCounters(connection=False)

Get a number of counters to verify the sanity of the Replicas in the catalog

getReplicaStatus(lfns, connection=False)

Get replica status from the catalog

getReplicas(lfns, allStatus, connection=False)

Get file replicas from the catalog

getReplicasByMetadata(metaDict, path, allStatus, credDict, connection=False)

Get file replicas for files corresponding to the given metadata

getSEDump(seName)
Return all the files at a given SE, together with checksum and size
Parameters:seName – name of the StorageElement
Returns:S_OK with list of tuples (lfn, checksum, size)
isFile(lfns, connection=False)

Determine whether a path is a file in the catalog

removeFile(lfns, connection=False)
removeReplica(lfns, connection=False)

Remove replica from catalog

setDatabase(database)
setFileGroup(path, gname)

Set the file group

Parameters:
  • path (str, int or list[int]) – file path as a string or int or list of ints or select statement
  • gname (str or int) – new group as a string or int gid
setFileMode(path, mode)

Set the file mode

Parameters:
  • path (str, int or list[int]) – file path as a string or int or list of ints or select statement
  • mode (int) – new mode
setFileOwner(path, owner)

Set the file owner

Parameters:
  • path (str, int or list[int]) – file path as a string or int or list of ints or select statement
  • owner (str or int) – new user as a string or int uid
setFileStatus(lfns, connection=False)

Get set the group for the supplied files

setReplicaHost(lfns, connection=False)

Set replica host in the catalog

setReplicaStatus(lfns, connection=False)

Set replica status in the catalog