Skip to content

Commit

Permalink
introduce triggers in annotations (#1569)
Browse files Browse the repository at this point in the history
* introduce events annotations

* introduce triggers in annotations
  • Loading branch information
savingoyal authored Oct 11, 2023
1 parent 5f373fe commit f9d8f85
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions metaflow/plugins/argo/argo_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,17 @@ def _compile_workflow_template(self):
# Some more annotations to populate the Argo UI nicely
if self.tags:
annotations.update({"metaflow/tags": json.dumps(self.tags)})
if self.triggers:
annotations.update(
{
"metaflow/triggers": json.dumps(
[
{key: trigger.get(key) for key in ["name", "type"]}
for trigger in self.triggers
]
)
}
)
if self.notify_on_error:
annotations.update(
{
Expand Down Expand Up @@ -1738,6 +1749,16 @@ def _compile_sensor(self):
}
)

# Useful to paint the UI
trigger_annotations = {
"metaflow/triggered_by": json.dumps(
[
{key: trigger.get(key) for key in ["name", "type"]}
for trigger in self.triggers
]
)
}

return (
Sensor()
.metadata(
Expand Down Expand Up @@ -1805,6 +1826,17 @@ def _compile_sensor(self):
"metadata": {
"generateName": "%s-" % self.name,
"namespace": KUBERNETES_NAMESPACE,
"annotations": {
"metaflow/triggered_by": json.dumps(
[
{
key: trigger.get(key)
for key in ["name", "type"]
}
for trigger in self.triggers
]
)
},
},
"spec": {
"arguments": {
Expand Down

0 comments on commit f9d8f85

Please sign in to comment.