pyicat_plus.client.metadata.IcatMetadataClient#
- class pyicat_plus.client.metadata.IcatMetadataClient(queue_urls=None, queue_name=None, monitor_port=None, timeout=None)[source]#
Bases:
objectClient for storing dataset metadata in ICAT.
- Parameters:
queue_urls (
Optional[List[str]])queue_name (
Optional[str])monitor_port (
Optional[int])timeout (
Optional[float])
- reschedule_investigation(investigation_id, strict=False)[source]#
- Raises:
IcatMetadataValidationError – If
strict=Trueand the metadata is invalid.- Emits IcatMetadataValidationWarning:
If
strict=Falseand 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:
IcatMetadataSerializationError – If metadata serialization fails.
IcatMetadataValidationError – If
strict=Trueand the metadata is invalid.
- Emits IcatMetadataValidationWarning:
If
strict=Falseand the metadata is invalid.- Emits IcatMetadataDeprecatedWarning:
If metadata is deprecated.
- 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=Trueand the metadata is invalid.- Emits IcatMetadataValidationWarning:
If
strict=Falseand 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=Trueand the metadata is invalid.- Emits IcatMetadataValidationWarning:
If
strict=Falseand the metadata is invalid.- Emits IcatMetadataDeprecatedWarning:
If metadata is deprecated.