scaffold.data.artifact_manager.artifact_id_manager
Attributes
Functions
|
Get a new artifact id. |
|
Validates input afid, i.e. an afid that is meant to be existing in the artifact store, as it is needed as |
Validates a given target afid or generates a new one. |
Module Contents
- scaffold.data.artifact_manager.artifact_id_manager.get_new_afid(artifact_manager: scaffold.data.artifact_manager.base.ArtifactManager, prefix: str = None) str
Get a new artifact id.
The identifiers are triplets of random words, to make them more distinguishable for the human eye, plus the timestamp to ensure uniqueness. Optionally, a prefix can be added to the id.
- Parameters:
prefix – String to be added to the uid, empty by default
- Returns:
String in form of prefix__new_id__timestamp
- scaffold.data.artifact_manager.artifact_id_manager.validate_input_afid(artifact_manager: scaffold.data.artifact_manager.base.ArtifactManager, afid: str) None
Validates input afid, i.e. an afid that is meant to be existing in the artifact store, as it is needed as input to a entrypoint.
- Parameters:
afid – An artifact id that is supposed to be existing in the artifact store.
- Raises:
ValueError if an afid was given, but it does not exist in the artifact store. –
- scaffold.data.artifact_manager.artifact_id_manager.validate_or_generate_target_afid(artifact_manager: scaffold.data.artifact_manager.base.ArtifactManager, afid: str | None = None, prefix: str | None = None) str
Validates a given target afid or generates a new one.
Takes the given afid and checks its validity, raises a ValueError if not. If the given afid is None, a new afid is returned with the optional prefix. Can be used when validating any afid parameters that are meant for targets. Target afids refer to the ids for artifacts that will be generated by your entrypoint and therefore should not exist yet, in contrast to “input afids” which are ids for artifacts an entrypoint needs as input to do something, and therefore _should_ exist in the artifact store.
- Parameters:
afid – An artifact id that is supposed to be not used yet on the server, default None.
prefix – Only used when afid is None. Will be the prefix of the new afid.
- Raises:
ValueError if an afid was given, but it already exists in the artifact store. –
- Returns:
Either the given afid if its valid, or a new one.
- scaffold.data.artifact_manager.artifact_id_manager.FILESYSTEM
- scaffold.data.artifact_manager.artifact_id_manager.logger