Commit 89c04848 authored by Samuel GAIST's avatar Samuel GAIST

[algorithm] Make default dataformat search look for more types

The test prefix and generated platform prefix have two different
content, therefore, search for both integer and integers to ensure
one is found at run time.

Fixes #67
parent d372150c
Pipeline #27467 passed with stage
in 19 minutes and 1 second
......@@ -58,20 +58,25 @@ def load_algorithm_prototype(prefix):
algorithm_data = json.loads(
pkg_resources.resource_string(__name__, "prototypes/algorithm.json")
)
ref_dataformat = "integers"
ref_dataformats = ["integer", "integers"]
dataformat = None
for root, dirs, _ in os.walk(prefix, "algorithm"):
if ref_dataformat in dirs:
dataformat_versions = sorted(os.listdir(os.path.join(root, ref_dataformat)))
version = dataformat_versions[-1].split(".")[0]
dataformat = "{}/{}/{}".format(
os.path.basename(root), ref_dataformat, version
)
break
assert dataformat is not None, ( # nosec
"Reference data format %s not found" % ref_dataformat
)
for ref_dataformat in ref_dataformats:
for root, dirs, _ in os.walk(os.path.join(prefix, "dataformats")):
if ref_dataformat in dirs:
dataformat_versions = sorted(
os.listdir(os.path.join(root, ref_dataformat))
)
version = dataformat_versions[-1].split(".")[0]
dataformat = "{}/{}/{}".format(
os.path.basename(root), ref_dataformat, version
)
break
if dataformat is None:
raise RuntimeError(
"Reference data formats [{}] not found".format(",".join(ref_dataformats))
)
algorithm_data["groups"][0]["inputs"]["in_data"]["type"] = dataformat
algorithm_data["groups"][0]["outputs"]["out_data"]["type"] = dataformat
return algorithm_data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment