Commit 0936a76d authored by André Anjos's avatar André Anjos 💬

Merge branch '67_fix_algorithm_default_dataformat' into 'master'

Make default dataformat search look for more types on algorithm prototype load

Closes #67

See merge request !56
parents d372150c 89c04848
Pipeline #27477 failed with stages
in 20 minutes and 3 seconds
......@@ -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