Registration Processor

Register the given file or directory with the DLM.

class ska_dlm_client.registration_processor.Item(path_rel_to_watch_dir, item_type, metadata, parent=None)

Data Item related information to aid registration.

__eq__(other)

Return self==value.

__hash__ = None
__init__(path_rel_to_watch_dir, item_type, metadata, parent=None)

Initialise the Item with required values.

The uuid is updated after being registered.

__repr__()

Return repr(self).

__weakref__

list of weak references to the object (if defined)

class ska_dlm_client.registration_processor.RegistrationProcessor(config)

Processes the registration of data items with the DLM.

This class handles the registration of data items with the DLM system, including sending registration requests to the DLM API and handling the migration of data items between storage locations.

__init__(config)

Initialize the RegistrationProcessor with the given configuration.

Args:
config: The configuration object containing DLM connection settings

and other parameters needed for registration and migration.

__weakref__

list of weak references to the object (if defined)

add_path(absolute_path, path_rel_to_watch_dir)

Add the given path to the DLM.

The logic is as follows: 1) If absolute_path is a file, it will be registered as a single item. 2) If absolute_path is a MS (.ms) directory, it will be registered as an opaque container (its contents are not traversed). Metadata is assumed to reside in the parent directory. 3) If absolute_path is a directory, it will be registered as a container with metadata (if present). All files within the container will be registered as children. Any subdirectory will be treated recursively using the same logic.

Return type:

str | None

Args:

absolute_path: The absolute path to the file or directory to register. path_rel_to_watch_dir: The path relative to the watch directory.

get_config()

Get the configuration being used by the RegistrationProcessor.

Return type:

Any

Returns:

The current configuration object.

register_data_products_from_watch_directory()

Register all data products found in the watch directory with the DLM.

Iterates through all items in the configured watch directory and registers each one with the DLM using the add_path method.

set_config(config)

Set or reset the configuration used by the RegistrationProcessor.

Return type:

None

Args:

config: The new configuration object to use.

ska_dlm_client.registration_processor.directory_contains_metadata_file(absolute_path)

Check if the given directory contains a metadata file.

Return type:

bool

Args:

absolute_path: The absolute path to the directory.

Returns:

True if the metadata file exists in the directory, False otherwise.