Skip to content

Commit

Permalink
json serialize the ancestry metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed Jan 27, 2025
1 parent 7833e40 commit e762192
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions metaflow/client/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,10 +1224,11 @@ def _get_metadata_query_vals(
def _get_related_tasks(self, is_ancestor: bool) -> Dict[str, List[str]]:
flow_id, run_id, _, _ = self.path_components
metadata_dict = self.metadata_dict
# The specific values in the metadata are json serialized strings, so we need to load them before use.
steps = (
metadata_dict.get("previous-steps")
json.loads(metadata_dict.get("previous-steps"))
if is_ancestor
else metadata_dict.get("successor-steps")
else json.loads(metadata_dict.get("successor-steps"))
)

if not steps:
Expand Down
10 changes: 5 additions & 5 deletions metaflow/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,19 @@ def run_step(
[
MetaDatum(
field="foreach-indices",
value=foreach_indices,
value=json.dumps(foreach_indices),
type="foreach-indices",
tags=metadata_tags,
),
MetaDatum(
field="foreach-indices-truncated",
value=foreach_indices_truncated,
value=json.dumps(foreach_indices_truncated),
type="foreach-indices-truncated",
tags=metadata_tags,
),
MetaDatum(
field="foreach-step-names",
value=foreach_step_names,
value=json.dumps(foreach_step_names),
type="foreach-step-names",
tags=metadata_tags,
),
Expand Down Expand Up @@ -783,13 +783,13 @@ def run_step(
),
MetaDatum(
field="previous-steps",
value=previous_steps,
value=json.dumps(previous_steps),
type="previous-steps",
tags=metadata_tags,
),
MetaDatum(
field="successor-steps",
value=successor_steps,
value=json.dumps(successor_steps),
type="successor-steps",
tags=metadata_tags,
),
Expand Down

0 comments on commit e762192

Please sign in to comment.