Skip to content

Commit

Permalink
make dag info available through argo workflow template annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
saikonen committed Dec 11, 2024
1 parent b3b109a commit 3904fe8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,18 @@ def _compile_workflow_template(self):
)
}
)
try:
# Build the DAG based on the DAGNodes given by the FlowGraph for the found FlowSpec class.
steps_info, graph_structure = self.graph.output_steps()
graph_info = {
"steps": steps_info,
"graph_structure": graph_structure,
"doc": self.graph.doc,
}
except Exception:
graph_info = None

dag_annotation = {"metaflow/dag": json.dumps(graph_info)}

return (
WorkflowTemplate()
Expand All @@ -758,6 +770,7 @@ def _compile_workflow_template(self):
.label("app.kubernetes.io/name", "metaflow-flow")
.label("app.kubernetes.io/part-of", "metaflow")
.annotations(annotations)
.annotations(dag_annotation)
)
.spec(
WorkflowSpec()
Expand Down

0 comments on commit 3904fe8

Please sign in to comment.