Skip to content

Feature: universal hashing of any object #465

Description

@woutdenolf
from ewokscore import Task
from ewoks import execute_graph

class MyClass:
    pass


class TestTask(Task, input_names=["object"], output_names=["object"]):
    def run(self):
        print("EXECUTED")
        self.outputs.object = self.inputs.object


graph = {"id": "testworkflow", "schema_version": "1.1"}
nodes = [
    {"id": "task1", "task_type": "class", "task_identifier": "__main__.TestTask"},
]
links = []
workflow = {"graph": graph, "nodes": nodes, "links": links}


inputs = [{"id": "task1", "name": "object", "value": MyClass()}]

varinfo = {"root_uri": "myresults", "scheme": "nexus"}
# varinfo = {"root_uri": "myresults", "scheme": "json"}
result = execute_graph(
    workflow,
    varinfo=varinfo,
    inputs=inputs,
    convert_destination="myresults/workflows.json",
    save_options={"serializer": "json_pickle"}
)
print(result)
  File ".../ewokscore/src/ewokscore/hashing.py", line 108, in uhash
    raise TypeError(f"cannot uhash {value} (type: {type(value)})")
TypeError: cannot uhash <__main__.MyClass object at 0x7fe386ddf7d0> (type: <class '__main__.MyClass'>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions