Skip to content

Elasticsearch meta

Elasticsearch based metadata plugin.

Classes

ElasticDidMeta

ElasticDidMeta(
    hosts=None,
    user=None,
    password=None,
    index=None,
    archive_index=None,
    use_ssl=False,
    verify_certs=True,
    ca_certs=None,
    client_cert=None,
    client_key=None,
    request_timeout=100,
    max_retries=3,
    retry_on_timeout=False,
)

Functions

get_metadata
get_metadata(scope, name, *, session=None)

Get data identifier metadata.

PARAMETER DESCRIPTION
scope

The scope name

TYPE: InternalScope

name

The data identifier name

TYPE: str

session

The database session in use

TYPE: Optional[Session] DEFAULT: None

RETURNS DESCRIPTION
dict[str, Any]

The metadata for the did

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID metadata is not found.

RucioException

If another error occurs during the process.

set_metadata
set_metadata(
    scope,
    name,
    key,
    value,
    recursive=False,
    *,
    session=None
)

Set single metadata key.

PARAMETER DESCRIPTION
scope

the scope of did

TYPE: InternalScope

name

the name of the did

TYPE: str

key

the key to be added

TYPE: str

value

the value of the key to be added

TYPE: str

recursive

recurse into DIDs (not supported)

TYPE: bool DEFAULT: False

session

The database session in use

TYPE: Optional[Session] DEFAULT: None

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID is not found.

RucioException

If an error occurs while setting the metadata.

set_metadata_bulk
set_metadata_bulk(
    scope, name, meta, recursive=False, *, session=None
)

Bulk set metadata keys.

PARAMETER DESCRIPTION
scope

the scope of did

TYPE: InternalScope

name

the name of the did

TYPE: str

meta

dictionary of metadata keypairs to be added

TYPE: dict[str, Any]

recursive

recurse into DIDs (not supported)

TYPE: bool DEFAULT: False

session

The database session in use

TYPE: Optional[Session] DEFAULT: None

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID is not found.

UnsupportedOperation

If recursive inserts are requested (currently unsupported).

RucioException

If an error occurs while setting the metadata.

delete_metadata
delete_metadata(scope, name, key, *, session=None)

Delete a key from metadata.

PARAMETER DESCRIPTION
scope

the scope of did

TYPE: InternalScope

name

the name of the did

TYPE: str

key

the key to be deleted

TYPE: str

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID is not found.

RucioException

If an error occurs while setting the metadata.

list_dids
list_dids(
    scope,
    filters,
    did_type="collection",
    ignore_case=False,
    limit=None,
    offset=None,
    long=False,
    recursive=False,
    ignore_dids=None,
    *,
    session=None
)

List DIDs (Data Identifier).

PARAMETER DESCRIPTION
scope

The scope of the DIDs to search.

TYPE: InternalScope

filters

The filters to apply to the DID search.

TYPE: Union[list[dict[str, Any]], dict[str, Any]]

did_type

The type of DID (default is 'collection').

TYPE: Literal['all', 'collection', 'dataset', 'container', 'file'] DEFAULT: 'collection'

ignore_case

Whether to ignore case (default is False).

TYPE: bool DEFAULT: False

limit

The maximum number of DIDs to return.

TYPE: Optional[int] DEFAULT: None

offset

The starting point for the search (used for pagination).

TYPE: Optional[int] DEFAULT: None

long

Whether to return extended information (scope, name, did_type, bytes, length) (default is False).

TYPE: bool DEFAULT: False

recursive

Whether to search recursively (currently unsupported).

TYPE: bool DEFAULT: False

ignore_dids

A list of DIDs to ignore (default is an empty list).

TYPE: Optional[list] DEFAULT: None

session

The database session in use.

TYPE: Optional[Session] DEFAULT: None

RETURNS DESCRIPTION
Iterator[dict[str, Any]]

A generator yielding DIDs as strings (when long is False) or dictionaries (when long is True).

RAISES DESCRIPTION
UnsupportedOperation

If recursive searches are requested (currently unsupported).

RucioException

If an error occurs during the search.

on_delete
on_delete(scope, name, archive=False, session=None)

Delete a document and optionally archive it.

PARAMETER DESCRIPTION
scope

The scope of the document

TYPE: InternalScope

name

The name of the document

TYPE: str

archive

Whether to archive the document before deletion

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID is not found.

RucioException

If an error occurs while setting the metadata.

get_metadata_archived
get_metadata_archived(scope, name, session=None)

Retrieve archived metadata for a given scope and name.

PARAMETER DESCRIPTION
scope

The scope of the document

TYPE: InternalScope

name

The name of the document

TYPE: str

RETURNS DESCRIPTION
None

The archived metadata or None if not found

RAISES DESCRIPTION
DataIdentifierNotFound

If the DID is not found.

RucioException

If an error occurs while setting the metadata.

get_plugin_name
get_plugin_name()

Returns a unique identifier for this plugin. This can be later used for filtering down results to this plugin only.

RETURNS DESCRIPTION
str

The name of the plugin