weaver.provenance

Definitions related to Provenance features and the W3C PROV specification.

Module Contents

weaver.provenance.AnyProvenanceFormat[source]
class weaver.provenance.ProvenancePathType[source]

Constants container that provides similar functionalities to ExtendedEnum without explicit Enum membership.

PROV = '/prov'[source]
PROV_INFO = '/prov/info'[source]
PROV_WHO = '/prov/who'[source]
PROV_INPUTS = '/prov/inputs'[source]
PROV_OUTPUTS = '/prov/outputs'[source]
PROV_RUN = '/prov/run'[source]
PROV_RUNS = '/prov/runs'[source]
classmethod types() → List[str][source]
classmethod as_type(prov: Any) → str | None[source]
classmethod get(prov: weaver.typedefs.AnyKey | weaver.base.EnumType | ProvenancePathType, default: Any | None = None, run_id: str | None = None) → ProvenancePathType | None[source]
class weaver.provenance.ProvenanceFormat[source]

Constants container that provides similar functionalities to ExtendedEnum without explicit Enum membership.

PROV_JSON = 'PROV-JSON'[source]
PROV_JSONLD = 'PROV-JSONLD'[source]
PROV_XML = 'PROV-XML'[source]
PROV_TURTLE = 'PROV-TURTLE'[source]
PROV_N = 'PROV-N'[source]
PROV_NT = 'PROV-NT'[source]
_media_types[source]
_rev_path_types[source]
_profiles[source]
classmethod get(prov_format: AnyProvenanceFormat | None, default: Any | None = None, allow_media_type: bool = False) → ProvenanceFormat | None[source]
classmethod media_types() → List[weaver.formats.ContentType][source]
classmethod formats() → List[ProvenanceFormat | str][source]
classmethod as_media_type(prov_format: AnyProvenanceFormat | None, output_format: weaver.formats.AnyOutputFormat | None = None) → weaver.formats.AnyContentType | None[source]
classmethod as_profile(prov_format: AnyProvenanceFormat | None, output_format: weaver.formats.AnyOutputFormat | None = None) → weaver.typedefs.URL | None[source]
classmethod resolve_compatible_formats(prov: ProvenancePathType | str | None, prov_format: ProvenanceFormat | str | None, output_format: weaver.formats.OutputFormat | str | None) → Tuple[ProvenanceFormat | None, str | None][source]

Resolves multiple OutputFormat and ProvenanceFormat combinations for compatible formats.

Compatible formats depend on the PROV endpoint being requested. If output format is not specified, apply the corresponding PROV format that will work transparently. Otherwise, ensure they are aligned against the expected PROV endpoints and supported Media-Types.

Returns:

Tuple of a resolved PROV format if only the output format was specified, and the relevant error detail if they are incompatible.

class weaver.provenance.WeaverResearchObject(job: weaver.datatype.Job, settings: weaver.typedefs.AnySettingsContainer, fs_access: cwltool.stdfsaccess.StdFsAccess, temp_prefix_ro: str = 'tmp', orcid: str = '', full_name: str = '')[source]

Defines extended Provenance details with Weaver operations and referencing the active server instance.

Initialize the ResearchObject.

job[source]
ro_uuid[source]
base_uri[source]
settings[source]
static sha1_uuid(document: prov.model.ProvDocument, identifier: str) → str[source]

Generate a prefixed SHA1 hash from the identifier value.

initialize_provenance(full_name: str, host_provenance: bool, user_provenance: bool, orcid: str, fsaccess: cwltool.stdfsaccess.StdFsAccess, run_uuid: uuid.UUID | None = None) → cwltool.cwlprov.provenance_profile.ProvenanceProfile[source]

Hook Weaver metadata onto user provenance step.

resolve_user() → Tuple[str, str][source]

Override cwltool.cwlprov default machine user.

It is expected that the CWL runner will executed by the weaver-worker (i.e.: via celery). Define a generic user to avoid exposing implementation-specific “OS” user that will not be informative for the generated Provenance. Using a distinct name than just “_Weaver_” allows preserving the distinction between the API _agent_ and the “user” _agent_ for which Job execution is acted on behalf between these _agent_ endoffs.

resolve_host() → Tuple[str, str][source]

Override cwltool default machine host.