DirectoryMetadata

DIRAC FileCatalog mix-in class to manage directory metadata

class DIRAC.DataManagementSystem.DB.FileCatalogComponents.DirectoryMetadata.DirectoryMetadata.DirectoryMetadata(database=None)

Bases: object

__init__(database=None)
addMetadataField(pName, pType, credDict)

Add a new metadata parameter to the Metadata Database.

Parameters:
  • pName (str) – parameter name

  • pType (str) – parameter type in the MySQL notation

Returns:

S_OK/S_ERROR, Value - comment on a positive result

addMetadataSet(metaSetName, metaSetDict, credDict)

Add a new metadata set with the contents from metaSetDict

Parameters:
  • metaSetName (str) – metaSet name

  • metaSetDict (dict) – contents of the meta set definition

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

deleteMetadataField(pName, credDict)

Remove metadata field

Parameters:
  • pName (str) – meta parameter name

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

findDirIDsByMetadata(**kwargs)
findDirectoriesByMetadata(**kwargs)
findFileIDsByMetadata(metaDict, path, credDict, startItem=0, maxItems=25)

Find Files satisfying the given metadata

Parameters:
  • metaDict (dict) – dictionary with the selection metadata

  • path (str) – starting directory path

  • credDict (dict) – client credential dictionary

  • startItem (int) – offset in the file list

  • maxItems (int) – max number of files to rteurn

Returns:

S_OK/S_ERROR, Value list file IDs in selected directories

findFilesByMetadata(metaDict, path, credDict)

Find Files satisfying the given metadata

Parameters:
  • metaDict (dict) – dictionary with the selection metadata

  • path (str) – starting directory path

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value list files in selected directories

getCompatibleMetadata(queryDict, path, credDict)

Get distinct metadata values compatible with the given already defined metadata

Parameters:
  • queryDict (dict) – dictionary containing query data

  • path (str) – starting directory path

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value dictionary of metadata

getDirectoryMetaParameters(dpath, credDict, inherited=True)

Get meta parameters for the given directory

Parameters:
  • dPath (str) – directory name

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value dictionary of meta parameters

getDirectoryMetadata(path, credDict, inherited=True, ownData=True)

Get metadata for the given directory aggregating metadata for the directory itself and for all the parent directories if inherited flag is True. Get also the non-indexed metadata parameters.

Parameters:
  • path (str) – directory name

  • credDict (dict) – client credential dictionary

  • inherited (bool) – flag to include metadata from the parent directories

  • ownData (bool) – flag to include metadata for the directory itself

Returns:

S_OK/S_ERROR, Value dictionary of metadata

getMetadataFields(credDict)

Get all the defined metadata fields

Parameters:

credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value is the metadata:metadata type dictionary

getMetadataSet(metaSetName, expandFlag, credDict)

Get fully expanded contents of the metadata set

Parameters:
  • metaSetName (str) – metaSet name

  • expandFlag (bool) – flag to whether to expand the metaset recursively

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value dictionary of the meta set definition contents

removeMetadata(dPath, metaData, credDict)

Remove the specified metadata for the given directory

Parameters:
  • dPath (str) – directory path

  • metaData (dict) – metadata dictionary

  • credDict (dict) – client credential dictionary

Returns:

standard Dirac result object

removeMetadataForDirectory(dirList, credDict)

Remove all the metadata for the given directory list

Parameters:
  • dirList (list) – list of directory paths

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value Successful/Failed dictionaries

setDatabase(database)
setMetaParameter(dPath, metaName, metaValue, credDict)

Set an meta parameter - metadata which is not used in the the data search operations

Parameters:
  • dPath (str) – directory name

  • metaName (str) – meta parameter name

  • metaValue (str) – meta parameter value

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

setMetadata(dPath, metaDict, credDict)

Set the value of a given metadata field for the the given directory path

Parameters:
  • dPath (str) – directory path

  • metaDict (dict) – dictionary with metadata

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR