Skip to content

Commit

Permalink
Ensure correct flattening of manifest on load
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-shunned committed Sep 12, 2024
1 parent 5b0761e commit b0c9c2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
1 change: 0 additions & 1 deletion aiod_registry/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def get_location_type(self):
if isinstance(self.location_type, str):
self.location_type = [self.location_type]
return self
# Otherwise, determine the type
if not isinstance(self.location, list):
self.location = [self.location]
# Create a list to store the type of location
Expand Down
27 changes: 18 additions & 9 deletions aiod_registry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,26 @@ def load_manifests(
# Loop through the versions and tasks and remove inaccessible ones
for v_name, version in manifest.versions.items():
for task_name, task in version.tasks.items():
# Check model config path
for loc in task.config_path:
if is_accessible(loc):
task.config_path = loc
# Check model config path and flatten
for fpath in task.config_path:
if is_accessible(fpath):
res = fpath
break
else:
task.config_path = None
# Check which location is accessible
for loc in task.location:
res = None
new_manifest.versions[v_name].tasks[task_name].config_path = res
# Check which location is accessible and flatten
for i, loc in enumerate(task.location):
if is_accessible(loc):
# Store the first accessible location
task.location = loc
new_manifest.versions[v_name].tasks[
task_name
].location = loc
# Flatten the related location type
new_manifest.versions[v_name].tasks[
task_name
].location_type = task.location_type[i]
# NOTE: Not including config path here in case not paired order
break
# If no location is accessible, remove the task completely
else:
Expand Down Expand Up @@ -92,6 +100,7 @@ def load_manifests(
)
return new_manifests
else:
return manifests
# NOTE: Locations etc. at least get flattened
return new_manifests
else:
return manifests

0 comments on commit b0c9c2c

Please sign in to comment.