pyicat_plus.client.metadata.IcatMetadataClient#

class pyicat_plus.client.metadata.IcatMetadataClient(queue_urls=None, queue_name=None, monitor_port=None, timeout=None)[source]#

Bases: object

Client for storing dataset metadata in ICAT.

Parameters:
  • queue_urls (Optional[List[str]])

  • queue_name (Optional[str])

  • monitor_port (Optional[int])

  • timeout (Optional[float])

check_health()[source]#

Raises an exception when not healthy

disconnect()[source]#
reschedule_investigation(investigation_id, strict=False)[source]#
Raises:

IcatMetadataValidationError – If strict=True and the metadata is invalid.

Emits IcatMetadataValidationWarning:

If strict=False and the metadata is invalid.

Parameters:
  • investigation_id (str)

  • strict (bool)

send_metadata(beamline, proposal, dataset, path, metadata, strict=False)[source]#

Send dataset metadata to ICAT.

Parameters:
  • beamline (str) – The beamline name of the proposal.

  • proposal (str) – The proposal name.

  • dataset (str) – The dataset name.

  • path (str) – The path to the dataset on disk.

  • metadata (dict) – A dictionary of metadata to be attached to the dataset.

  • strict (bool) – Strict metadata validation.

Raises:
Emits IcatMetadataValidationWarning:

If strict=False and the metadata is invalid.

Emits IcatMetadataDeprecatedWarning:

If metadata is deprecated.

send_metadata_from_file(filename)[source]#
Parameters:

filename (str)

start_investigation(beamline, proposal, start_datetime=None, end_datetime=None, strict=False)[source]#

Send investigation metadata to ICAT.

Parameters:
  • beamline (str) – The beamline name of the proposal.

  • proposal (str) – The proposal name.

  • start_datetime – Start data or the investigation.

  • end_datetime – for unit tests (deprecated).

  • strict (bool) – Strict metadata validation.

Raises:

IcatMetadataValidationError – If strict=True and the metadata is invalid.

Emits IcatMetadataValidationWarning:

If strict=False and the metadata is invalid.

Emits IcatMetadataDeprecatedWarning:

If metadata is deprecated.

store_metadata(filename, beamline, proposal, dataset, path, metadata, strict=False)[source]#

Save dataset metadata in an XML file.

Parameters:
  • beamline (str) – The beamline name of the proposal.

  • proposal (str) – The proposal name.

  • dataset (str) – The dataset name.

  • path (str) – The path to the dataset on disk.

  • metadata (dict) – A dictionary of metadata to be attached to the dataset.

  • strict (bool) – Strict metadata validation.

  • filename (str)

Raises:

IcatMetadataValidationError – If strict=True and the metadata is invalid.

Emits IcatMetadataValidationWarning:

If strict=False and the metadata is invalid.

Emits IcatMetadataDeprecatedWarning:

If metadata is deprecated.