Beispiel #1
0
        def process_run_annotations(self, run):
            """``process_run_annotations`` hook implementation."""
            from renku.core.models.cwl.annotation import Annotation

            return [
                Annotation(id='_:annotation',
                           source='Dummy ProcessRun Hook',
                           body='dummy ProcessRun hook body')
            ]
Beispiel #2
0
        def cmdline_tool_annotations(self, tool):
            """``cmdline_tool_annotations`` hook implementation."""
            from renku.core.models.cwl.annotation import Annotation

            return [
                Annotation(id='_:annotation',
                           source='Dummy Cmdline Hook',
                           body='dummy cmdline hook body')
            ]
Beispiel #3
0
        def process_run_annotations(self, run):
            """``process_run_annotations`` hook implementation."""
            from renku.core.models.cwl.annotation import Annotation

            return [
                Annotation(id="_:annotation",
                           source="Dummy ProcessRun Hook",
                           body="dummy ProcessRun hook body")
            ]
Beispiel #4
0
        def cmdline_tool_annotations(self, tool):
            """``cmdline_tool_annotations`` hook implementation."""
            from renku.core.models.cwl.annotation import Annotation

            return [
                Annotation(id="_:annotation",
                           source="Dummy Cmdline Hook",
                           body="dummy cmdline hook body")
            ]
def process_run_annotations(run):
    """``process_run_annotations`` hook implementation."""
    mls = MLS(run)

    for p in run.paths:
        if p.startswith(str(mls.renku_mls_path)):
            path = Path(p)
            annotation_id = "{activity}/annotations/mls/{id}".format(
                activity=run._id, id=path.parts[-2])
            return [
                Annotation(id=annotation_id,
                           source="MLS plugin",
                           body=mls.load_model(path))
            ]

    return []
Beispiel #6
0
def process_run_annotations(run):
    """``process_run_annotations`` hook implementation."""
    aqs = AQS(run)

    #os.remove(os.path.join(aqs.renku_aqs_path, "site.py"))

    path = pathlib.Path("../sitecustomize.py")
    if path.exists():
        path.unlink()

    annotations = []

    print("process_run_annotations")

    if os.path.exists(aqs.renku_aqs_path):
        for p in aqs.renku_aqs_path.iterdir():
            if p.match("*json"):
                print(f"found json annotation: {p}")
                print(open(p).read())

            elif p.match("*jsonld"):
                print(
                    f"found jsonLD annotation: {p}\n",
                    json.dumps(json.load(p.open()), sort_keys=True, indent=4))

                # this will make annotations according to https://odahub.io/ontology/
                aqs_annotation = aqs.load_model(p)
                model_id = aqs_annotation["@id"]
                annotation_id = "{activity}/annotations/aqs/{id}".format(
                    activity=run._id, id=model_id)
                p.unlink()
                annotations.append(
                    Annotation(id=annotation_id,
                               source="AQS plugin",
                               body=aqs_annotation))
    else:
        print("nothing to process in process_run_annotations")

    return annotations