diff --git a/tests/test_provenance.py b/tests/test_provenance.py index 9d70a023f..dcb7704db 100644 --- a/tests/test_provenance.py +++ b/tests/test_provenance.py @@ -35,7 +35,7 @@ def test_provenance_formats(): result = ProvenanceFormat.formats expect = [ ProvenanceFormat.PROV_JSON, - ProvenanceFormat.PROV_JSON_LD, + ProvenanceFormat.PROV_JSONLD, ProvenanceFormat.PROV_TURTLE, ProvenanceFormat.PROV_N, ProvenanceFormat.PROV_XML, @@ -50,7 +50,7 @@ def test_provenance_media_types(): result = ProvenanceFormat.media_types expect = [ ContentType.APP_JSON, - ContentType.APP_JSON_LD, + ContentType.APP_JSONLD, ContentType.TEXT_TURTLE, ContentType.TEXT_PROVN, ContentType.TEXT_XML, @@ -67,7 +67,7 @@ def test_provenance_media_types(): (None, None), ("prov-json", ProvenanceFormat.PROV_JSON), ("PROV-JSON", ProvenanceFormat.PROV_JSON), - ("PROV-JSON-LD", ProvenanceFormat.PROV_JSON_LD), + ("PROV-JSON-LD", ProvenanceFormat.PROV_JSONLD), ] ) def test_provenance_format(provenance, expect): @@ -81,7 +81,7 @@ def test_provenance_format(provenance, expect): [ (None, None), (ProvenanceFormat.PROV_JSON, ContentType.APP_JSON), - (ProvenanceFormat.PROV_JSON_LD, ContentType.APP_JSON_LD), + (ProvenanceFormat.PROV_JSONLD, ContentType.APP_JSONLD), (ProvenanceFormat.PROV_XML, ContentType.APP_XML), (ProvenanceFormat.PROV_NT, ContentType.APP_NT), (ProvenanceFormat.PROV_N, ContentType.TEXT_PROVN), @@ -101,7 +101,7 @@ def test_provenance_as_media_type(provenance, expect): # only main PROV path allow format variants (ProvenancePathType.PROV, None, None, ProvenanceFormat.PROV_JSON, False), (ProvenancePathType.PROV, ProvenanceFormat.PROV_JSON, None, ProvenanceFormat.PROV_JSON, False), - (ProvenancePathType.PROV, ProvenanceFormat.PROV_JSON_LD, None, ProvenanceFormat.PROV_JSON_LD, False), + (ProvenancePathType.PROV, ProvenanceFormat.PROV_JSONLD, None, ProvenanceFormat.PROV_JSONLD, False), (ProvenancePathType.PROV, ProvenanceFormat.PROV_XML, None, ProvenanceFormat.PROV_XML, False), (ProvenancePathType.PROV, ProvenanceFormat.PROV_NT, None, ProvenanceFormat.PROV_NT, False), (ProvenancePathType.PROV, ProvenanceFormat.PROV_N, None, ProvenanceFormat.PROV_N, False), diff --git a/weaver/cli.py b/weaver/cli.py index ed8d51603..eac625343 100644 --- a/weaver/cli.py +++ b/weaver/cli.py @@ -2686,7 +2686,7 @@ def add_timeout_param(parser): def add_provenance_params(parser): # type: (argparse.ArgumentParser) -> None parser.add_argument( - "-pT", "--prov", "--prov-type", dest="prov", nargs=1, + "-pT", "--prov", "--prov-type", dest="prov", choices=ProvenancePathType.types, help=( "Desired PROV metadata contents. " @@ -2695,7 +2695,7 @@ def add_provenance_params(parser): ) ) parser.add_argument( - "-pF", "--prov-format", dest="prov_format", nargs=1, + "-pF", "--prov-format", dest="prov_format", choices=ProvenanceFormat.formats, help=( "Desired PROV metadata schema representation. " @@ -2706,7 +2706,7 @@ def add_provenance_params(parser): ) ) parser.add_argument( - "-pR", "--run", "--prov-run", dest="prov_run_id", nargs=1, + "-pR", "--run", "--prov-run", dest="prov_run_id", choices=ProvenancePathType.types, help=( "Specific run (i.e.: a nested Workflow step) for which to retrieve Provenance metadata. " diff --git a/weaver/datatype.py b/weaver/datatype.py index 7d607c787..d10949581 100644 --- a/weaver/datatype.py +++ b/weaver/datatype.py @@ -1491,7 +1491,7 @@ def prov_path(self, container=None, extra_path=None, prov_format=None): (None, None): prov_path, # the directory itself with all metadata ("/prov", None): f"{prov_path}/metadata/provenance/primary.cwlprov.json", ("/prov", ProvenanceFormat.PROV_JSON): f"{prov_path}/metadata/provenance/primary.cwlprov.json", - ("/prov", ProvenanceFormat.PROV_JSON_LD): f"{prov_path}/metadata/provenance/primary.cwlprov.jsonld", + ("/prov", ProvenanceFormat.PROV_JSONLD): f"{prov_path}/metadata/provenance/primary.cwlprov.jsonld", ("/prov", ProvenanceFormat.PROV_TURTLE): f"{prov_path}/metadata/provenance/primary.cwlprov.ttl", ("/prov", ProvenanceFormat.PROV_XML): f"{prov_path}/metadata/provenance/primary.cwlprov.xml", ("/prov", ProvenanceFormat.PROV_N): f"{prov_path}/metadata/provenance/primary.cwlprov.provn", @@ -1522,7 +1522,7 @@ def prov_data( prov_path = self.prov_path(container=container) if not prov_path or not os.path.isdir(prov_path): return None, None - path = extra_path.split("/prov/", 1)[-1] + path = str(extra_path).split("/prov/", 1)[-1] frag = path.strip("/").split("/") oper, params = frag[0], frag[1:] args = ["-d", prov_path, oper] diff --git a/weaver/formats.py b/weaver/formats.py index 12c74eb46..449429f7c 100644 --- a/weaver/formats.py +++ b/weaver/formats.py @@ -96,7 +96,7 @@ class ContentType(Constants): APP_GZIP = "application/gzip" APP_HDF5 = "application/x-hdf5" APP_JSON = "application/json" - APP_JSON_LD = "application/ld+json" + APP_JSONLD = "application/ld+json" APP_RAW_JSON = "application/raw+json" APP_OAS_JSON = "application/vnd.oai.openapi+json; version=3.0" APP_OGC_PKG_JSON = "application/ogcapppkg+json" diff --git a/weaver/provenance.py b/weaver/provenance.py index d878de6cb..1676a816e 100644 --- a/weaver/provenance.py +++ b/weaver/provenance.py @@ -37,6 +37,7 @@ class ProvenancePathType(Constants): PROV_INPUTS = "/prov/inputs" PROV_OUTPUTS = "/prov/outputs" PROV_RUN = "/prov/run" + PROV_RUNS = "/prov/runs" @classmethod @classproperty @@ -78,7 +79,7 @@ def get( # pylint: disable=W0221,W0237 # arguments differ/renamed fo class ProvenanceFormat(Constants): PROV_JSON = "PROV-JSON" - PROV_JSON_LD = "PROV-JSON-LD" + PROV_JSONLD = "PROV-JSONLD" PROV_XML = "PROV-XML" PROV_TURTLE = "PROV-TURTLE" PROV_N = "PROV-N" @@ -86,7 +87,7 @@ class ProvenanceFormat(Constants): _media_types = { ContentType.APP_JSON: PROV_JSON, - ContentType.APP_JSON_LD: PROV_JSON_LD, + ContentType.APP_JSONLD: PROV_JSONLD, ContentType.TEXT_TURTLE: PROV_TURTLE, ContentType.TEXT_PROVN: PROV_N, ContentType.TEXT_XML: PROV_XML, @@ -171,7 +172,7 @@ def resolve_compatible_formats( return err_mismatch if out_fmt in [OutputFormat.JSON, OutputFormat.YAML, OutputFormat.YML]: - if prov_format not in [None, ProvenanceFormat.PROV_JSON, ProvenanceFormat.PROV_JSON_LD]: + if prov_format not in [None, ProvenanceFormat.PROV_JSON, ProvenanceFormat.PROV_JSONLD]: return err_mismatch if prov_format is None: prov_format = ProvenanceFormat.PROV_JSON diff --git a/weaver/wps_restapi/api.py b/weaver/wps_restapi/api.py index 63c6bcc3c..f0f800e77 100644 --- a/weaver/wps_restapi/api.py +++ b/weaver/wps_restapi/api.py @@ -103,6 +103,7 @@ def get_conformance(category, settings): # ogcapi_proc_part3 = "http://www.opengis.net/spec/ogcapi-processes-3/1.0" ogcapi_proc_enabled = asbool(settings.get("weaver.wps_restapi", True)) ogcapi_proc_html = asbool(settings.get("weaver.wps_restapi_html", True)) + ogcapi_proc_prov = asbool(settings.get("weaver.cwl_prov", True)) ogcapi_proc_conformance = ([ f"{ogcapi_common}/conf/core", f"{ogcapi_common}/per/core/additional-link-relations", @@ -553,12 +554,14 @@ def get_conformance(category, settings): f"{ogcapi_proc_part4}/req/job-management/update-patch-op", f"{ogcapi_proc_part4}/req/job-management/update-response", f"{ogcapi_proc_part4}/req/job-management/update-response-locked", + ] + ([ f"{ogcapi_proc_part4}/req/provenance", f"{ogcapi_proc_part4}/req/provenance/prov-get-op", f"{ogcapi_proc_part4}/req/provenance/prov-response", f"{ogcapi_proc_part4}/req/provenance/prov-content-negotiation", f"{ogcapi_proc_part4}/req/provenance/inputs-get-op", f"{ogcapi_proc_part4}/req/provenance/inputs-response", + ] if ogcapi_proc_prov else []) + [ # FIXME: employ 'weaver.wps_restapi.quotation.utils.check_quotation_supported' to add below conditionally # FIXME: https://github.com/crim-ca/weaver/issues/156 (billing/quotation) # https://github.com/opengeospatial/ogcapi-processes/tree/master/extensions/billing @@ -667,6 +670,7 @@ def api_frontpage_body(settings): weaver_url = get_weaver_url(settings) weaver_config = get_weaver_configuration(settings) + weaver_rtd_url = "https://pavics-weaver.readthedocs.io/en/latest" weaver_api = asbool(settings.get("weaver.wps_restapi", True)) weaver_api_url = get_wps_restapi_base_url(settings) weaver_api_oas_ui = weaver_url + sd.api_openapi_ui_service.path if weaver_api else None @@ -676,12 +680,19 @@ def api_frontpage_body(settings): weaver_api_ref = settings.get("weaver.wps_restapi_ref", None) if weaver_api else None weaver_api_html = asbool(settings.get("weaver.wps_restapi_html", True)) and weaver_api weaver_api_html_url = f"{weaver_api_url}?f={OutputFormat.HTML}" + weaver_api_prov = asbool(settings.get("weaver.cwl_prov", True)) and weaver_api + weaver_api_prov_doc = f"{weaver_rtd_url}/processes.html#job-provenance" + weaver_api_prov_oas = f"{weaver_api_oas_ui}#/Provenance" if weaver_api_prov else None weaver_wps = asbool(settings.get("weaver.wps")) weaver_wps_url = get_wps_url(settings) if weaver_wps else None + weaver_wps_oas = f"{weaver_api_oas_ui}#/WPS" if weaver_wps else None weaver_conform_url = weaver_url + sd.api_conformance_service.path weaver_process_url = weaver_api_url + sd.processes_service.path weaver_jobs_url = weaver_api_url + sd.jobs_service.path weaver_vault = asbool(settings.get("weaver.vault")) + weaver_vault_url = f"{weaver_api_url}/vault" if weaver_vault else None + weaver_vault_api = f"{weaver_api_oas_ui}#/Vault" if weaver_vault else None + weaver_vault_doc = f"{weaver_rtd_url}/processes.html#vault-upload" weaver_links = [ {"href": weaver_url, "rel": "self", "type": ContentType.APP_JSON, "title": "This landing page."}, {"href": weaver_conform_url, "rel": "http://www.opengis.net/def/rel/ogc/1.0/conformance", @@ -785,10 +796,13 @@ def api_frontpage_body(settings): "description": __meta__.__description__, "attribution": __meta__.__author__, "parameters": [ - {"name": "api", "enabled": weaver_api, "url": weaver_api_url, "api": weaver_api_oas_ui}, + {"name": "api", "enabled": weaver_api, "url": weaver_api_url, + "doc": weaver_rtd_url, "api": weaver_api_oas_ui}, {"name": "html", "enabled": weaver_api_html, "url": weaver_api_html_url, "api": weaver_api_oas_ui}, - {"name": "vault", "enabled": weaver_vault}, - {"name": "wps", "enabled": weaver_wps, "url": weaver_wps_url, "api": weaver_api_oas_ui}, + {"name": "prov", "enabled": weaver_api_prov, "doc": weaver_api_prov_doc, "api": weaver_api_prov_oas}, + {"name": "vault", "enabled": weaver_vault, "url": weaver_vault_url, + "doc": weaver_vault_doc, "api": weaver_vault_api}, + {"name": "wps", "enabled": weaver_wps, "url": weaver_wps_url, "api": weaver_wps_oas}, ], "links": weaver_links, } diff --git a/weaver/wps_restapi/examples/job_prov.json b/weaver/wps_restapi/examples/job_prov.json index e69de29bb..3543f60a8 100644 --- a/weaver/wps_restapi/examples/job_prov.json +++ b/weaver/wps_restapi/examples/job_prov.json @@ -0,0 +1,427 @@ +{ + "prefix": { + "wfprov": "http://purl.org/wf4ever/wfprov#", + "wfdesc": "http://purl.org/wf4ever/wfdesc#", + "cwlprov": "https://w3id.org/cwl/prov#", + "foaf": "http://xmlns.com/foaf/0.1/", + "schema": "http://schema.org/", + "orcid": "https://orcid.org/", + "id": "urn:uuid:", + "data": "urn:hash::sha1:", + "sha256": "nih:sha-256;", + "researchobject": "arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/", + "metadata": "arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/metadata/", + "provenance": "arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/metadata/provenance/", + "wf": "arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/workflow/packed.cwl#", + "input": "arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/workflow/primary-job.json#", + "doi": "https://doi.org/", + "wf4ever": "http://purl.org/wf4ever/wf4ever#" + }, + "agent": { + "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b": [ + {}, + { + "prov:type": { + "$": "foaf:OnlineAccount", + "type": "prov:QUALIFIED_NAME" + }, + "prov:location": "http://localhost:4002", + "cwlprov:hostname": "localhost" + }, + { + "prov:type": { + "$": "foaf:OnlineAccount", + "type": "prov:QUALIFIED_NAME" + }, + "prov:label": "crim-ca/weaver:6.1.0", + "foaf:accountName": "crim-ca/weaver:6.1.0" + } + ], + "id:b3a49ee7-f620-4154-9e4d-d2e948748deb": { + "prov:type": [ + { + "$": "schema:Person", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "prov:Person", + "type": "prov:QUALIFIED_NAME" + } + ], + "prov:label": "crim-ca/weaver:6.1.0", + "foaf:name": "crim-ca/weaver:6.1.0", + "foaf:account": { + "$": "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b", + "type": "prov:QUALIFIED_NAME" + }, + "schema:name": "crim-ca/weaver:6.1.0" + }, + "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c": { + "prov:type": [ + { + "$": "prov:SoftwareAgent", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "wfprov:WorkflowEngine", + "type": "prov:QUALIFIED_NAME" + } + ], + "prov:label": "cwltool 3.1.20240708091338.dev15+g9c05bb7d" + }, + "data:15401f8d937f5d526951c1bf20dcba16a1271d97": { + "prov:type": { + "$": "prov:SoftwareAgent", + "type": "prov:QUALIFIED_NAME" + }, + "prov:location": "https://example.com/weaver", + "prov:label": [ + "Weaver internal WPS used for demo and testing.", + "crim-ca/weaver:6.1.0" + ], + "prov:generalEntity": "data:644e201526525f62152815a76a2dc773450f3dd9", + "prov:specificEntity": "doi:10.5281/zenodo.14210717" + }, + "id:2148aee6-81e4-4bcd-9e48-78ff46a51ff1": { + "prov:type": { + "$": "prov:SoftwareAgent", + "type": "prov:QUALIFIED_NAME" + }, + "cwlprov:image": "debian:stretch-slim", + "prov:label": "Container execution of image debian:stretch-slim" + } + }, + "actedOnBehalfOf": { + "_:id1": { + "prov:delegate": "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b", + "prov:responsible": "id:b3a49ee7-f620-4154-9e4d-d2e948748deb" + }, + "_:id6": { + "prov:delegate": "data:15401f8d937f5d526951c1bf20dcba16a1271d97", + "prov:responsible": "id:b3a49ee7-f620-4154-9e4d-d2e948748deb" + } + }, + "wasStartedBy": { + "_:id2": { + "prov:activity": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:starter": "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b", + "prov:time": "2024-12-12T09:16:17.843783" + }, + "_:id4": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:starter": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:time": "2024-12-12T09:16:17.843852" + }, + "_:id10": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:trigger": "data:15401f8d937f5d526951c1bf20dcba16a1271d97" + }, + "_:id11": { + "prov:activity": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:trigger": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T14:15:50.834000+00:00" + } + }, + "activity": { + "id:1c49f085-bbd7-410d-a801-81fd42469e8a": { + "prov:startTime": "2024-12-12T09:16:17.843806", + "prov:type": { + "$": "wfprov:WorkflowRun", + "type": "prov:QUALIFIED_NAME" + }, + "prov:label": "Run of workflow/packed.cwl#main" + } + }, + "wasAssociatedWith": { + "_:id3": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:agent": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:plan": "wf:main" + }, + "_:id18": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:agent": "id:2148aee6-81e4-4bcd-9e48-78ff46a51ff1" + } + }, + "entity": { + "data:644e201526525f62152815a76a2dc773450f3dd9": { + "prov:type": { + "$": "prov:PrimarySource", + "type": "prov:QUALIFIED_NAME" + }, + "prov:label": "Source code repository", + "prov:location": "https://github.com/crim-ca/weaver" + }, + "data:3102f6d7a018ebae572f457d711ed7e1e7a11bc2": { + "prov:type": { + "$": "prov:Organization", + "type": "prov:QUALIFIED_NAME" + }, + "foaf:name": "Computer Research Institute of Montr\u00e9al", + "schema:name": "Computer Research Institute of Montr\u00e9al" + }, + "data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0": { + "foaf:name": "CRIM", + "schema:name": "CRIM", + "prov:location": "http://pavics-weaver.readthedocs.org/en/latest/", + "prov:type": { + "$": "prov:Organization", + "type": "prov:QUALIFIED_NAME" + }, + "prov:label": "Server Provider" + }, + "id:1c49f085-bbd7-410d-a801-81fd42469e8a": { + "prov:type": { + "$": "wfdesc:ProcessRun", + "type": "prov:QUALIFIED_NAME" + }, + "prov:location": "https://example.com/weaver/processes/echo/jobs/1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:label": "Job Information" + }, + "data:15401f8d937f5d526951c1bf20dcba16a1271d97:echo": { + "prov:type": { + "$": "wfdesc:Process", + "type": "prov:QUALIFIED_NAME" + }, + "prov:location": "https://example.com/weaver/processes/echo", + "prov:label": "Process Description" + }, + "wf:main": { + "prov:type": [ + { + "$": "wfdesc:Process", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "prov:Plan", + "type": "prov:QUALIFIED_NAME" + } + ], + "prov:label": "Prospective provenance" + }, + "data:2ef7bde608ce5404e97d5f042f95f89f1c232871": [ + { + "prov:type": { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + }, + "prov:value": "Hello World!" + }, + { + "prov:type": { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + }, + "prov:value": "Hello World!" + } + ], + "data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b": [ + { + "prov:type": { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + } + }, + {} + ], + "id:59967079-217e-4bdb-92d7-2ef2f784825c": { + "prov:type": [ + { + "$": "wf4ever:File", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + } + ], + "cwlprov:basename": "stdout.log", + "cwlprov:nameroot": "stdout", + "cwlprov:nameext": ".log" + }, + "data:da39a3ee5e6b4b0d3255bfef95601890afd80709": { + "prov:type": { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + } + }, + "id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b": { + "prov:type": [ + { + "$": "wf4ever:File", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + } + ], + "cwlprov:basename": "stderr.log", + "cwlprov:nameroot": "stderr", + "cwlprov:nameext": ".log" + }, + "id:6b04550d-c2bd-400b-858b-14e287bbf8c3": { + "prov:type": [ + { + "$": "wf4ever:File", + "type": "prov:QUALIFIED_NAME" + }, + { + "$": "wfprov:Artifact", + "type": "prov:QUALIFIED_NAME" + } + ], + "cwlprov:basename": "stdout.log", + "cwlprov:nameroot": "stdout", + "cwlprov:nameext": ".log" + } + }, + "wasDerivedFrom": { + "_:id5": { + "prov:generatedEntity": "data:15401f8d937f5d526951c1bf20dcba16a1271d97", + "prov:usedEntity": "data:644e201526525f62152815a76a2dc773450f3dd9", + "prov:type": { + "$": "prov:PrimarySource", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id9": { + "prov:generatedEntity": "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b", + "prov:usedEntity": "data:15401f8d937f5d526951c1bf20dcba16a1271d97" + }, + "_:id15": { + "prov:generatedEntity": "data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0", + "prov:usedEntity": "data:15401f8d937f5d526951c1bf20dcba16a1271d97" + } + }, + "specializationOf": { + "_:id7": { + "prov:specificEntity": "data:15401f8d937f5d526951c1bf20dcba16a1271d97", + "prov:generalEntity": "id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b" + }, + "_:id12": { + "prov:specificEntity": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:generalEntity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a" + }, + "_:id20": { + "prov:specificEntity": "id:59967079-217e-4bdb-92d7-2ef2f784825c", + "prov:generalEntity": "data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b" + }, + "_:id22": { + "prov:specificEntity": "id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b", + "prov:generalEntity": "data:da39a3ee5e6b4b0d3255bfef95601890afd80709" + }, + "_:id24": { + "prov:specificEntity": "id:6b04550d-c2bd-400b-858b-14e287bbf8c3", + "prov:generalEntity": "data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b" + } + }, + "wasAttributedTo": { + "_:id8": { + "prov:entity": "data:3102f6d7a018ebae572f457d711ed7e1e7a11bc2", + "prov:agent": "data:644e201526525f62152815a76a2dc773450f3dd9" + }, + "_:id16": { + "prov:entity": "data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0", + "prov:agent": "data:15401f8d937f5d526951c1bf20dcba16a1271d97" + } + }, + "alternateOf": { + "_:id13": { + "prov:alternate1": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:alternate2": "id:1c49f085-bbd7-410d-a801-81fd42469e8a" + } + }, + "wasGeneratedBy": { + "_:id14": { + "prov:entity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:activity": "data:15401f8d937f5d526951c1bf20dcba16a1271d97:echo" + }, + "_:id21": { + "prov:entity": "id:59967079-217e-4bdb-92d7-2ef2f784825c", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.867039", + "prov:role": { + "$": "wf:main/echo/output", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id23": { + "prov:entity": "id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.867039", + "prov:role": { + "$": "wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id25": { + "prov:entity": "id:6b04550d-c2bd-400b-858b-14e287bbf8c3", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.867039", + "prov:role": { + "$": "wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id27": { + "prov:entity": "id:59967079-217e-4bdb-92d7-2ef2f784825c", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.869180", + "prov:role": { + "$": "wf:main/primary/output", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id28": { + "prov:entity": "id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.869180", + "prov:role": { + "$": "wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id29": { + "prov:entity": "id:6b04550d-c2bd-400b-858b-14e287bbf8c3", + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.869180", + "prov:role": { + "$": "wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1", + "type": "prov:QUALIFIED_NAME" + } + } + }, + "used": { + "_:id17": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:entity": "data:2ef7bde608ce5404e97d5f042f95f89f1c232871", + "prov:time": "2024-12-12T09:16:17.846280", + "prov:role": { + "$": "wf:main/message", + "type": "prov:QUALIFIED_NAME" + } + }, + "_:id19": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:entity": "data:2ef7bde608ce5404e97d5f042f95f89f1c232871", + "prov:time": "2024-12-12T09:16:17.863017", + "prov:role": { + "$": "wf:main/echo/message", + "type": "prov:QUALIFIED_NAME" + } + } + }, + "wasEndedBy": { + "_:id26": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:ender": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:time": "2024-12-12T09:16:18.867034" + }, + "_:id30": { + "prov:activity": "id:1c49f085-bbd7-410d-a801-81fd42469e8a", + "prov:ender": "id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c", + "prov:time": "2024-12-12T09:16:18.869299" + } + } +} diff --git a/weaver/wps_restapi/examples/job_prov.txt b/weaver/wps_restapi/examples/job_prov.txt index e69de29bb..85d8c34c9 100644 --- a/weaver/wps_restapi/examples/job_prov.txt +++ b/weaver/wps_restapi/examples/job_prov.txt @@ -0,0 +1,71 @@ +document + prefix wfprov + prefix wfdesc + prefix cwlprov + prefix foaf + prefix schema + prefix orcid + prefix id + prefix data + prefix sha256 + prefix researchobject + prefix metadata + prefix provenance + prefix wf + prefix input + prefix doi + prefix wf4ever + + agent(id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b) + agent(id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b, [prov:type='foaf:OnlineAccount', prov:location="http://localhost:4002", cwlprov:hostname="localhost"]) + agent(id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b, [prov:type='foaf:OnlineAccount', prov:label="crim-ca/weaver:6.0.0", foaf:accountName="crim-ca/weaver:6.0.0"]) + agent(id:b3a49ee7-f620-4154-9e4d-d2e948748deb, [prov:type='schema:Person', prov:type='prov:Person', prov:label="crim-ca/weaver:6.0.0", foaf:name="crim-ca/weaver:6.0.0", foaf:account='id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b', schema:name="crim-ca/weaver:6.0.0"]) + actedOnBehalfOf(id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b, id:b3a49ee7-f620-4154-9e4d-d2e948748deb, -) + agent(id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, [prov:type='prov:SoftwareAgent', prov:type='wfprov:WorkflowEngine', prov:label="cwltool 3.1.20240708091338.dev15+g9c05bb7d"]) + wasStartedBy(id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, -, id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b, 2024-12-12T09:16:17.843783) + activity(id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:17.843806, -, [prov:type='wfprov:WorkflowRun', prov:label="Run of workflow/packed.cwl#main"]) + wasAssociatedWith(id:1c49f085-bbd7-410d-a801-81fd42469e8a, id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, wf:main) + wasStartedBy(id:1c49f085-bbd7-410d-a801-81fd42469e8a, -, id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, 2024-12-12T09:16:17.843852) + entity(data:644e201526525f62152815a76a2dc773450f3dd9, [prov:type='prov:PrimarySource', prov:label="Source code repository", prov:location="https://github.com/crim-ca/weaver"]) + agent(data:15401f8d937f5d526951c1bf20dcba16a1271d97, [prov:type='prov:SoftwareAgent', prov:location="http://localhost:4002", prov:label="Weaver internal WPS used for demo and testing.", prov:label="crim-ca/weaver:6.0.0", prov:generalEntity='data:644e201526525f62152815a76a2dc773450f3dd9', prov:specificEntity='doi:10.5281/zenodo.14210717']) + entity(data:3102f6d7a018ebae572f457d711ed7e1e7a11bc2, [prov:type='prov:Organization', foaf:name="Computer Research Institute of MontrĂ©al", schema:name="Computer Research Institute of MontrĂ©al"]) + entity(data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0, [foaf:name="CRIM", schema:name="CRIM", prov:location="http://pavics-weaver.readthedocs.org/en/latest/", prov:type='prov:Organization', prov:label="Server Provider"]) + entity(id:1c49f085-bbd7-410d-a801-81fd42469e8a, [prov:type='wfdesc:ProcessRun', prov:location="http://localhost:4002/processes/echo/jobs/1c49f085-bbd7-410d-a801-81fd42469e8a", prov:label="Job Information"]) + entity(data:15401f8d937f5d526951c1bf20dcba16a1271d97:echo, [prov:type='wfdesc:Process', prov:location="http://localhost:4002/processes/echo", prov:label="Process Description"]) + wasDerivedFrom(data:15401f8d937f5d526951c1bf20dcba16a1271d97, data:644e201526525f62152815a76a2dc773450f3dd9, -, -, -, [prov:type='prov:PrimarySource']) + actedOnBehalfOf(data:15401f8d937f5d526951c1bf20dcba16a1271d97, id:b3a49ee7-f620-4154-9e4d-d2e948748deb, -) + specializationOf(data:15401f8d937f5d526951c1bf20dcba16a1271d97, id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b) + wasAttributedTo(data:3102f6d7a018ebae572f457d711ed7e1e7a11bc2, data:644e201526525f62152815a76a2dc773450f3dd9) + wasDerivedFrom(id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b, data:15401f8d937f5d526951c1bf20dcba16a1271d97, -, -, -) + wasStartedBy(id:1c49f085-bbd7-410d-a801-81fd42469e8a, data:15401f8d937f5d526951c1bf20dcba16a1271d97, -, -) + wasStartedBy(id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, id:1c49f085-bbd7-410d-a801-81fd42469e8a, -, 2024-12-12T14:15:50.834000+00:00) + specializationOf(id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, id:1c49f085-bbd7-410d-a801-81fd42469e8a) + alternateOf(id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, id:1c49f085-bbd7-410d-a801-81fd42469e8a) + wasGeneratedBy(id:1c49f085-bbd7-410d-a801-81fd42469e8a, data:15401f8d937f5d526951c1bf20dcba16a1271d97:echo, -) + wasDerivedFrom(data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0, data:15401f8d937f5d526951c1bf20dcba16a1271d97, -, -, -) + wasAttributedTo(data:838cdfa4bbf09d1aedd26d79b46bfa8778ede2e0, data:15401f8d937f5d526951c1bf20dcba16a1271d97) + entity(wf:main, [prov:type='wfdesc:Process', prov:type='prov:Plan', prov:label="Prospective provenance"]) + entity(data:2ef7bde608ce5404e97d5f042f95f89f1c232871, [prov:type='wfprov:Artifact', prov:value="Hello World!"]) + used(id:1c49f085-bbd7-410d-a801-81fd42469e8a, data:2ef7bde608ce5404e97d5f042f95f89f1c232871, 2024-12-12T09:16:17.846280, [prov:role='wf:main/message']) + agent(id:2148aee6-81e4-4bcd-9e48-78ff46a51ff1, [prov:type='prov:SoftwareAgent', cwlprov:image="debian:stretch-slim", prov:label="Container execution of image debian:stretch-slim"]) + wasAssociatedWith(id:1c49f085-bbd7-410d-a801-81fd42469e8a, id:2148aee6-81e4-4bcd-9e48-78ff46a51ff1, -) + entity(data:2ef7bde608ce5404e97d5f042f95f89f1c232871, [prov:type='wfprov:Artifact', prov:value="Hello World!"]) + used(id:1c49f085-bbd7-410d-a801-81fd42469e8a, data:2ef7bde608ce5404e97d5f042f95f89f1c232871, 2024-12-12T09:16:17.863017, [prov:role='wf:main/echo/message']) + entity(data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b, [prov:type='wfprov:Artifact']) + entity(id:59967079-217e-4bdb-92d7-2ef2f784825c, [prov:type='wf4ever:File', prov:type='wfprov:Artifact', cwlprov:basename="stdout.log", cwlprov:nameroot="stdout", cwlprov:nameext=".log"]) + specializationOf(id:59967079-217e-4bdb-92d7-2ef2f784825c, data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b) + wasGeneratedBy(id:59967079-217e-4bdb-92d7-2ef2f784825c, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.867039, [prov:role='wf:main/echo/output']) + entity(data:da39a3ee5e6b4b0d3255bfef95601890afd80709, [prov:type='wfprov:Artifact']) + entity(id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b, [prov:type='wf4ever:File', prov:type='wfprov:Artifact', cwlprov:basename="stderr.log", cwlprov:nameroot="stderr", cwlprov:nameext=".log"]) + specializationOf(id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b, data:da39a3ee5e6b4b0d3255bfef95601890afd80709) + wasGeneratedBy(id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.867039, [prov:role='wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4']) + entity(data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b) + entity(id:6b04550d-c2bd-400b-858b-14e287bbf8c3, [prov:type='wf4ever:File', prov:type='wfprov:Artifact', cwlprov:basename="stdout.log", cwlprov:nameroot="stdout", cwlprov:nameext=".log"]) + specializationOf(id:6b04550d-c2bd-400b-858b-14e287bbf8c3, data:a0b65939670bc2c010f4d5d6a0b3e4e4590fb92b) + wasGeneratedBy(id:6b04550d-c2bd-400b-858b-14e287bbf8c3, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.867039, [prov:role='wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1']) + wasEndedBy(id:1c49f085-bbd7-410d-a801-81fd42469e8a, -, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.867034) + wasGeneratedBy(id:59967079-217e-4bdb-92d7-2ef2f784825c, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.869180, [prov:role='wf:main/primary/output']) + wasGeneratedBy(id:2ab450c1-7309-4c5b-b65b-b4dfa44f384b, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.869180, [prov:role='wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4']) + wasGeneratedBy(id:6b04550d-c2bd-400b-858b-14e287bbf8c3, id:1c49f085-bbd7-410d-a801-81fd42469e8a, 2024-12-12T09:16:18.869180, [prov:role='wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1']) + wasEndedBy(id:1c49f085-bbd7-410d-a801-81fd42469e8a, -, id:eea8f699-1c08-47b2-8aed-8ad30e4eda4c, 2024-12-12T09:16:18.869299) +endDocument diff --git a/weaver/wps_restapi/examples/job_prov.xml b/weaver/wps_restapi/examples/job_prov.xml index e69de29bb..c25e44535 100644 --- a/weaver/wps_restapi/examples/job_prov.xml +++ b/weaver/wps_restapi/examples/job_prov.xml @@ -0,0 +1,267 @@ + + + + + http://localhost:4002 + foaf:OnlineAccount + localhost + + + crim-ca/weaver:6.0.0 + foaf:OnlineAccount + crim-ca/weaver:6.0.0 + + + crim-ca/weaver:6.0.0 + schema:Person + id:53a6e2b3-6ee3-4f37-a2e5-72af3e97c70b + crim-ca/weaver:6.0.0 + crim-ca/weaver:6.0.0 + + + + + + + cwltool 3.1.20240708091338.dev15+g9c05bb7d + wfprov:WorkflowEngine + + + + + 2024-12-12T09:16:17.843783 + + + 2024-12-12T09:16:17.843806 + Run of workflow/packed.cwl#main + wfprov:WorkflowRun + + + + + + + + + + 2024-12-12T09:16:17.843852 + + + Source code repository + https://github.com/crim-ca/weaver + + + Weaver internal WPS used for demo and testing. + crim-ca/weaver:6.0.0 + http://localhost:4002 + + + + + Computer Research Institute of Montréal + Computer Research Institute of Montréal + + + Server Provider + http://pavics-weaver.readthedocs.org/en/latest/ + CRIM + CRIM + + + Job Information + http://localhost:4002/processes/echo/jobs/1c49f085-bbd7-410d-a801-81fd42469e8a + wfdesc:ProcessRun + + + Process Description + http://localhost:4002/processes/echo + wfdesc:Process + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2024-12-12T14:15:50.834000+00:00 + + + + + + + + + + + + + + + + + + + + + + + Prospective provenance + wfdesc:Process + + + wfprov:Artifact + Hello World! + + + + + 2024-12-12T09:16:17.846280 + wf:main/message + + + Container execution of image debian:stretch-slim + debian:stretch-slim + + + + + + + wfprov:Artifact + Hello World! + + + + + 2024-12-12T09:16:17.863017 + wf:main/echo/message + + + wfprov:Artifact + + + wf4ever:File + wfprov:Artifact + stdout.log + .log + stdout + + + + + + + + + 2024-12-12T09:16:18.867039 + wf:main/echo/output + + + wfprov:Artifact + + + wf4ever:File + wfprov:Artifact + stderr.log + .log + stderr + + + + + + + + + 2024-12-12T09:16:18.867039 + wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4 + + + + wf4ever:File + wfprov:Artifact + stdout.log + .log + stdout + + + + + + + + + 2024-12-12T09:16:18.867039 + wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1 + + + + + 2024-12-12T09:16:18.867034 + + + + + 2024-12-12T09:16:18.869180 + wf:main/primary/output + + + + + 2024-12-12T09:16:18.869180 + wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4 + + + + + 2024-12-12T09:16:18.869180 + wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1 + + + + + 2024-12-12T09:16:18.869299 + + diff --git a/weaver/wps_restapi/examples/job_prov_info.txt b/weaver/wps_restapi/examples/job_prov_info.txt index e69de29bb..b353a3018 100644 --- a/weaver/wps_restapi/examples/job_prov_info.txt +++ b/weaver/wps_restapi/examples/job_prov_info.txt @@ -0,0 +1,5 @@ +Research Object of CWL workflow run +Research Object ID: arcp://uuid,1c49f085-bbd7-410d-a801-81fd42469e8a/ +Profile: https://w3id.org/cwl/prov/0.6.0 +Workflow run ID: urn:uuid:1c49f085-bbd7-410d-a801-81fd42469e8a +Packaged: 2024-12-12 diff --git a/weaver/wps_restapi/examples/job_prov_run.txt b/weaver/wps_restapi/examples/job_prov_run.txt index e69de29bb..cdb34242c 100644 --- a/weaver/wps_restapi/examples/job_prov_run.txt +++ b/weaver/wps_restapi/examples/job_prov_run.txt @@ -0,0 +1,10 @@ +2024-12-12 09:16:17.843852 Flow 1c49f085-bbd7-410d-a801-81fd42469e8a [ Run of workflow/packed.cwl#main +2024-12-12 09:16:17.846280 In 2ef7bde608ce5404e97d5f042f95f89f1c232871 < wf:main/message +2024-12-12 09:16:17.863017 In 2ef7bde608ce5404e97d5f042f95f89f1c232871 < wf:main/echo/message + 2024-12-12 09:16:18.867039 Out 59967079-217e-4bdb-92d7-2ef2f784825c > wf:main/echo/output + 2024-12-12 09:16:18.867039 Out 2ab450c1-7309-4c5b-b65b-b4dfa44f384b > wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4 + 2024-12-12 09:16:18.867039 Out 6b04550d-c2bd-400b-858b-14e287bbf8c3 > wf:main/echo/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1 + 2024-12-12 09:16:18.869180 Out 59967079-217e-4bdb-92d7-2ef2f784825c > wf:main/primary/output + 2024-12-12 09:16:18.869180 Out 2ab450c1-7309-4c5b-b65b-b4dfa44f384b > wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_c46f5d8d-e599-4152-8ded-f529e19524d4 + 2024-12-12 09:16:18.869180 Out 6b04550d-c2bd-400b-858b-14e287bbf8c3 > wf:main/primary/PACKAGE_OUTPUT_HOOK_LOG_606e3f88-0388-4c97-b139-58fed24b37c1 + 2024-12-12 09:16:18.867034 Flow 1c49f085-bbd7-410d-a801-81fd42469e8a ] Run of workflow/packed.cwl#main (0:00:01.023182) diff --git a/weaver/wps_restapi/examples/job_prov_who.txt b/weaver/wps_restapi/examples/job_prov_who.txt index e69de29bb..a20e771f4 100644 --- a/weaver/wps_restapi/examples/job_prov_who.txt +++ b/weaver/wps_restapi/examples/job_prov_who.txt @@ -0,0 +1,2 @@ +Packaged By: cwltool 3.1.20240708091338.dev15+g9c05bb7d +Executed By: crim-ca/weaver:6.1.0 diff --git a/weaver/wps_restapi/jobs/__init__.py b/weaver/wps_restapi/jobs/__init__.py index d9df9ee7b..e28ecc3ac 100644 --- a/weaver/wps_restapi/jobs/__init__.py +++ b/weaver/wps_restapi/jobs/__init__.py @@ -1,6 +1,10 @@ import logging from typing import TYPE_CHECKING +from pyramid.settings import asbool + +from weaver.utils import get_settings + if TYPE_CHECKING: from pyramid.config import Configurator @@ -11,3 +15,14 @@ def includeme(config): # type: (Configurator) -> None LOGGER.info("Adding WPS REST API jobs...") config.include("weaver.wps_restapi.jobs.jobs") + + settings = get_settings(config) + weaver_cwl_prov = asbool(settings.get("weaver.cwl_prov", True)) + if not weaver_cwl_prov: + LOGGER.warning( + "Skipping Weaver PROV views [weaver.cwl_prov=false]. " + "Job Provenance endpoints will not be available." + ) + else: + LOGGER.info("Adding Weaver REST API Job Provenance....") + config.include("weaver.wps_restapi.jobs.prov") diff --git a/weaver/wps_restapi/jobs/jobs.py b/weaver/wps_restapi/jobs/jobs.py index 22a17ec39..e507e2826 100644 --- a/weaver/wps_restapi/jobs/jobs.py +++ b/weaver/wps_restapi/jobs/jobs.py @@ -44,7 +44,6 @@ get_job, get_job_io_schema_query, get_job_list_links, - get_job_prov_response, get_job_results_response, get_job_status_schema, get_results, @@ -763,177 +762,6 @@ def get_job_stats(request): return HTTPOk(json=body) -@sd.provider_prov_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvEndpoint(), - accept=sd.JobProvAcceptHeader.validator.choices, - response_schemas=sd.get_job_prov_responses, -) -@sd.process_prov_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvEndpoint(), - accept=sd.JobProvAcceptHeader.validator.choices, - response_schemas=sd.get_job_prov_responses, -) -@sd.job_prov_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvEndpoint(), - accept=sd.JobProvAcceptHeader.validator.choices, - response_schemas=sd.get_job_prov_responses, -) -@sd.provider_prov_info_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_info_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_info_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_who_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_who_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_who_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_inputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_inputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_inputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_inputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_inputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_inputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_outputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_outputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_outputs_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_outputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_outputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_outputs_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_responses, # FIXME -) -@sd.provider_prov_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_run_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.provider_prov_run_id_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], - schema=sd.ProviderJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.process_prov_run_id_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], - schema=sd.ProcessJobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@sd.job_prov_run_id_service.get( - tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], - schema=sd.JobProvMetadataEndpoint(), - accept=ContentType.TEXT_PLAIN, - response_schemas=sd.get_job_prov_metadata_responses, -) -@log_unhandled_exceptions(logger=LOGGER, message=sd.InternalServerErrorResponseSchema.description) -def get_job_prov(request): - # type: (PyramidRequest) -> AnyResponseType - """ - Retrieve the provenance details of a job based on the contextual request path. - """ - return get_job_prov_response(request) - - @sd.provider_result_service.get( tags=[sd.TAG_JOBS, sd.TAG_RESULTS, sd.TAG_PROVIDERS, sd.TAG_DEPRECATED], schema=sd.ProviderResultEndpoint(), @@ -977,15 +805,6 @@ def includeme(config): config.add_cornice_service(sd.job_exceptions_service) config.add_cornice_service(sd.job_logs_service) config.add_cornice_service(sd.job_stats_service) - config.add_cornice_service(sd.job_prov_service) - config.add_cornice_service(sd.job_prov_info_service) - config.add_cornice_service(sd.job_prov_who_service) - config.add_cornice_service(sd.job_prov_inputs_service) - config.add_cornice_service(sd.job_prov_inputs_run_service) - config.add_cornice_service(sd.job_prov_outputs_service) - config.add_cornice_service(sd.job_prov_outputs_run_service) - config.add_cornice_service(sd.job_prov_run_service) - config.add_cornice_service(sd.job_prov_run_id_service) config.add_cornice_service(sd.process_jobs_service) config.add_cornice_service(sd.process_job_service) config.add_cornice_service(sd.process_results_service) @@ -994,15 +813,6 @@ def includeme(config): config.add_cornice_service(sd.process_exceptions_service) config.add_cornice_service(sd.process_logs_service) config.add_cornice_service(sd.process_stats_service) - config.add_cornice_service(sd.process_prov_service) - config.add_cornice_service(sd.process_prov_info_service) - config.add_cornice_service(sd.process_prov_who_service) - config.add_cornice_service(sd.process_prov_inputs_service) - config.add_cornice_service(sd.process_prov_inputs_run_service) - config.add_cornice_service(sd.process_prov_outputs_service) - config.add_cornice_service(sd.process_prov_outputs_run_service) - config.add_cornice_service(sd.process_prov_run_service) - config.add_cornice_service(sd.process_prov_run_id_service) config.add_cornice_service(sd.provider_job_service) config.add_cornice_service(sd.provider_jobs_service) config.add_cornice_service(sd.provider_results_service) @@ -1011,15 +821,6 @@ def includeme(config): config.add_cornice_service(sd.provider_exceptions_service) config.add_cornice_service(sd.provider_logs_service) config.add_cornice_service(sd.provider_stats_service) - config.add_cornice_service(sd.provider_prov_service) - config.add_cornice_service(sd.provider_prov_info_service) - config.add_cornice_service(sd.provider_prov_who_service) - config.add_cornice_service(sd.provider_prov_inputs_service) - config.add_cornice_service(sd.provider_prov_inputs_run_service) - config.add_cornice_service(sd.provider_prov_outputs_service) - config.add_cornice_service(sd.provider_prov_outputs_run_service) - config.add_cornice_service(sd.provider_prov_run_service) - config.add_cornice_service(sd.provider_prov_run_id_service) # backward compatibility routes (deprecated) config.add_cornice_service(sd.job_result_service) diff --git a/weaver/wps_restapi/jobs/prov.py b/weaver/wps_restapi/jobs/prov.py index e69de29bb..c79db2c5b 100644 --- a/weaver/wps_restapi/jobs/prov.py +++ b/weaver/wps_restapi/jobs/prov.py @@ -0,0 +1,238 @@ +import logging +from typing import TYPE_CHECKING + +from weaver.exceptions import log_unhandled_exceptions +from weaver.formats import ContentType +from weaver.wps_restapi import swagger_definitions as sd +from weaver.wps_restapi.jobs.utils import get_job_prov_response + +if TYPE_CHECKING: + from pyramid.config import Configurator + + from weaver.typedefs import AnyResponseType, PyramidRequest + +LOGGER = logging.getLogger(__name__) + + +@sd.provider_prov_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvEndpoint(), + accept=sd.JobProvAcceptHeader.validator.choices, + response_schemas=sd.get_job_prov_responses, +) +@sd.process_prov_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvEndpoint(), + accept=sd.JobProvAcceptHeader.validator.choices, + response_schemas=sd.get_job_prov_responses, +) +@sd.job_prov_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvEndpoint(), + accept=sd.JobProvAcceptHeader.validator.choices, + response_schemas=sd.get_job_prov_responses, +) +@sd.provider_prov_info_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_info_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_info_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_who_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_who_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_who_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_inputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_inputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_inputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_inputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_inputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_inputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_outputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_outputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_outputs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_outputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_outputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_outputs_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_responses, # FIXME +) +@sd.provider_prov_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_run_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_run_id_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_run_id_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_run_id_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.provider_prov_runs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROVIDERS], + schema=sd.ProviderJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.process_prov_runs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE, sd.TAG_PROCESSES], + schema=sd.ProcessJobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@sd.job_prov_runs_service.get( + tags=[sd.TAG_JOBS, sd.TAG_PROVENANCE], + schema=sd.JobProvMetadataEndpoint(), + accept=ContentType.TEXT_PLAIN, + response_schemas=sd.get_job_prov_metadata_responses, +) +@log_unhandled_exceptions(logger=LOGGER, message=sd.InternalServerErrorResponseSchema.description) +def get_job_prov(request): + # type: (PyramidRequest) -> AnyResponseType + """ + Retrieve the provenance details of a job based on the contextual request path. + """ + return get_job_prov_response(request) + + +def includeme(config): + # type: (Configurator) -> None + LOGGER.info("Adding WPS REST API jobs PROV views...") + config.add_cornice_service(sd.job_prov_service) + config.add_cornice_service(sd.job_prov_info_service) + config.add_cornice_service(sd.job_prov_who_service) + config.add_cornice_service(sd.job_prov_inputs_service) + config.add_cornice_service(sd.job_prov_inputs_run_service) + config.add_cornice_service(sd.job_prov_outputs_service) + config.add_cornice_service(sd.job_prov_outputs_run_service) + config.add_cornice_service(sd.job_prov_run_service) + config.add_cornice_service(sd.job_prov_run_id_service) + config.add_cornice_service(sd.job_prov_runs_service) + config.add_cornice_service(sd.process_prov_service) + config.add_cornice_service(sd.process_prov_info_service) + config.add_cornice_service(sd.process_prov_who_service) + config.add_cornice_service(sd.process_prov_inputs_service) + config.add_cornice_service(sd.process_prov_inputs_run_service) + config.add_cornice_service(sd.process_prov_outputs_service) + config.add_cornice_service(sd.process_prov_outputs_run_service) + config.add_cornice_service(sd.process_prov_run_service) + config.add_cornice_service(sd.process_prov_run_id_service) + config.add_cornice_service(sd.process_prov_runs_service) + config.add_cornice_service(sd.provider_prov_service) + config.add_cornice_service(sd.provider_prov_info_service) + config.add_cornice_service(sd.provider_prov_who_service) + config.add_cornice_service(sd.provider_prov_inputs_service) + config.add_cornice_service(sd.provider_prov_inputs_run_service) + config.add_cornice_service(sd.provider_prov_outputs_service) + config.add_cornice_service(sd.provider_prov_outputs_run_service) + config.add_cornice_service(sd.provider_prov_run_service) + config.add_cornice_service(sd.provider_prov_run_id_service) + config.add_cornice_service(sd.provider_prov_runs_service) diff --git a/weaver/wps_restapi/swagger_definitions.py b/weaver/wps_restapi/swagger_definitions.py index 08519b0ef..084d8041d 100644 --- a/weaver/wps_restapi/swagger_definitions.py +++ b/weaver/wps_restapi/swagger_definitions.py @@ -375,6 +375,7 @@ job_prov_outputs_run_service = Service(name="job_prov_outputs_run", path=f"{job_prov_service.path}/outputs/{{run_id}}") job_prov_run_service = Service(name="job_prov_run", path=f"{job_prov_service.path}/run") job_prov_run_id_service = Service(name="job_prov_run_id", path=f"{job_prov_service.path}/run/{{run_id}}") +job_prov_runs_service = Service(name="job_prov_runs", path=f"{job_prov_service.path}/runs") processes_service = Service(name="processes", path="/processes") process_service = Service(name="process", path=f"{processes_service.path}/{{process_id}}") @@ -420,6 +421,10 @@ name="process_prov_run_id", path=process_service.path + job_prov_run_id_service.path, ) +process_prov_runs_service = Service( + name="process_prov_runs", + path=process_service.path + job_prov_runs_service.path, +) providers_service = Service(name="providers", path="/providers") provider_service = Service(name="provider", path=f"{providers_service.path}/{{provider_id}}") @@ -471,6 +476,10 @@ name="provider_prov_run_id", path=provider_service.path + process_prov_run_id_service.path, ) +provider_prov_runs_service = Service( + name="provider_prov_runs", + path=provider_service.path + process_prov_runs_service.path, +) # backward compatibility deprecated routes job_result_service = Service(name="job_result", path=f"{job_service.path}/result") @@ -6484,8 +6493,23 @@ class JobStatisticsSchema(ExtendedMappingSchema): class FrontpageParameterSchema(ExtendedMappingSchema): name = ExtendedSchemaNode(String(), example="api") enabled = ExtendedSchemaNode(Boolean(), example=True) - url = URL(description="Referenced parameter endpoint.", example="https://weaver-host", missing=drop) - doc = ExtendedSchemaNode(String(), example="https://weaver-host/api", missing=drop) + url = URL( + description="Referenced parameter endpoint. Root URL when the functionality implies multiple endpoints.", + example="https://weaver-host", + missing=drop, + ) + doc = ExtendedSchemaNode( + String(), + description="Endpoint where additional documentation can be found about the functionality.", + example="https://weaver-host/api", + missing=drop + ) + api = URL( + String(), + description="OpenAPI documentation endpoint about the functionality.", + example="https://weaver-host/api", + missing=drop, + ) class FrontpageParameters(ExtendedSequenceSchema): @@ -8524,7 +8548,23 @@ class GoneVaultFileDownloadResponse(ExtendedMappingSchema): "403": ForbiddenProviderLocalResponseSchema(), }) get_job_prov_responses = { - "200": OkGetJobProvResponse(description="Successful job PROV details."), + "200": OkGetJobProvResponse( + description="Successful job PROV details.", + examples={ + "PROV-JSON": { + "summary": "Provenance details returned in PROV-JSON format.", + "value": EXAMPLES["job_prov.json"], + }, + "PROV-N": { + "summary": "Provenance details returned in PROV-N format.", + "value": EXAMPLES["job_prov.txt"], + }, + "PROV-XML": { + "summary": "Provenance details returned in PROV-XML format.", + "value": EXAMPLES["job_prov.xml"], + } + } + ), "400": InvalidJobResponseSchema(), "404": NotFoundJobProvResponseSchema(), "406": NotAcceptableErrorResponseSchema(), @@ -8532,7 +8572,23 @@ class GoneVaultFileDownloadResponse(ExtendedMappingSchema): "500": InternalServerErrorResponseSchema(), } get_job_prov_metadata_responses = { - "200": OkGetJobProvMetadataResponse(description="Successful job PROV metadata retrieval."), + "200": OkGetJobProvMetadataResponse( + description="Successful job PROV metadata retrieval.", + examples={ + "PROV run": { + "summary": "Provenance metadata of the run execution.", + "value": EXAMPLES["job_prov_run.txt"], + }, + "PROV who": { + "summary": "Provenance metadata of who ran the job.", + "value": EXAMPLES["job_prov_who.txt"], + }, + "PROV info": { + "summary": "Provenance metadata about the Research Object packaging information.", + "value": EXAMPLES["job_prov_info.txt"], + } + } + ), "400": InvalidJobResponseSchema(), "404": NotFoundJobProvResponseSchema(), "406": NotAcceptableErrorResponseSchema(), diff --git a/weaver/wps_restapi/templates/responses/frontpage.mako b/weaver/wps_restapi/templates/responses/frontpage.mako index 572d17a5b..858325de9 100644 --- a/weaver/wps_restapi/templates/responses/frontpage.mako +++ b/weaver/wps_restapi/templates/responses/frontpage.mako @@ -80,6 +80,22 @@
Enabled:
${util.render_bool(param.enabled)} + %if "api" in param: +
+
OpenAPI:
+ +
+ %endif + %if "doc" in param: +
+
DOC:
+ +
+ %endif %if "url" in param:
URL: