Skip to content

Hdf5 persistency

Wout De Nolf requested to merge hdf5_persistency into main

image

Variables have a "scheme":

from ewokscore.variable import Variable

varinfo = {"root_uri": "/tmp/mydata", "scheme": "nexus"}

var1 = Variable(varinfo=varinfo)
var1.value = [1, 2, 3]
var1.dump()

var2 = Variable(uhash=var1.uhash, varinfo=varinfo)
assert var2.value.tolist() == var1.value

The "scheme" of task outputs can be specified for all tasks or for each task individually:

from ewokscore import load_graph


def add(*args):
    return sum(args)


nodes = [
    {
        "id": f"task{i}",
        "method": "__main__.add",
        "inputs": {0: 1},
        "varinfo": {"scheme": "nexus"},
    }
    for i in range(4)
]
links = [
    {"source": f"task{i}", "target": f"task{i+1}", "arguments": {1: "return_value"}}
    for i in range(3)
]

graph = load_graph({"nodes": nodes, "links": links})
varinfo = {"root_uri": "dataset.nx::/scan", "scheme": "json"}
graph.execute(varinfo=varinfo)
Edited by Wout De Nolf

Merge request reports

Loading