Jean Paul Azzopardi
06/11/2024, 1:05 PMAlexander Azzam
06/11/2024, 1:05 PMcollin
06/11/2024, 2:40 PMDon't receive any JSON or Prefect errors as well.I'm curious what the UI looks like after attempting to "Save & Exit". There are some intended error states I'd expect to surface that could block you in this state but those should have accompanying UI - for example validation errors on invalid JSON.
Jean Paul Azzopardi
06/12/2024, 11:59 AM{
"type": "compound",
"triggers": [
{
"type": "event",
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"match_related": {
"prefect.resource.id": [
"prefect.tag.fifteen-minutes"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 10
},
{
"type": "event",
"match": {},
"match_related": {
"prefect.resource.id": [
"prefect.tag.daily"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 108000
},
{
"type": "event",
"match": {},
"match_related": {
"prefect.resource.id": [
"prefect.tag.hourly"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 10800
},
{
"type": "event",
"match": {},
"match_related": {
"prefect.resource.id": [
"prefect.tag.six-hours"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 32400
},
{
"type": "event",
"match": {},
"match_related": {
"prefect.resource.id": [
"prefect.tag.minute"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 600
},
{
"type": "event",
"match": {},
"match_related": {
"prefect.resource.id": [
"prefect.tag.weekly"
],
"prefect.resource.role": "tag"
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 756000
}
],
"require": "any",
"within": 0
}
What I'm trying to add :
"actions": [
{
"type": "run-deployment",
"source": "selected",
"deployment_id": "...the uuid of the deployment...",
"parameters": {"some_kwarg": "{{ event.resource.id }}"}
}
]
}
Screen recording:collin
06/12/2024, 3:08 PMJean Paul Azzopardi
06/14/2024, 7:52 AM{
"type": "event",
"match": {
"prefect.resource.id": [
"prefect.flow-run.*",
"prefect.deployment.4ecda6e8-3b28-4146-aa6b-79eabe6a354d"
]
},
"match_related": {
"prefect.resource.id": [
"prefect.deployment.4ecda6e8-3b28-4146-aa6b-79eabe6a354d"
]
},
"after": [
"prefect.flow-run.Running",
"prefect.task-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 10
}
That returns event metadata.
but when i turn it into a compound trigger, with another event...
{
"type": "compound",
"triggers": [
{
"type": "event",
"match": {
"prefect.resource.id": [
"prefect.flow-run.*",
"prefect.deployment.4ecda6e8-3b28-4146-aa6b-79eabe6a354d"
]
},
"match_related": {
"prefect.resource.id": [
"prefect.deployment.4ecda6e8-3b28-4146-aa6b-79eabe6a354d"
]
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 10
},
{
"type": "event",
"match": {
"prefect.resource.id": [
"prefect.flow-run.*",
"prefect.deployment.e3f116cb-2b34-43ce-9743-d71113c9f666"
]
},
"match_related": {
"prefect.resource.id": [
"prefect.deployment.e3f116cb-2b34-43ce-9743-d71113c9f666"
]
},
"after": [
"prefect.flow-run.Running"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 10
}
],
"require": "any",
"within": 0
}
I no longer get event metadata when that trigger firescollin
06/14/2024, 3:05 PM"require": "all"
). Therefore your notification action receives the triggering events under the variable events
(notice the plural 's' at the end) in contrast to non-compound-type triggers which expose their triggering event under event
.
So I think you're looking for changing references from event.<something>
-> events[0].<something>
when configuring your action. Or using Jinja, you should be able to use a block like {% set event = events[0] %}
to require less tweaking.
This could use better discoverability and/or compatibility like if we were to prepopulate event with events[0] which would at least make the use of "require": "any"
here like you are doing more inline with using a non-compound trigger.collin
06/14/2024, 3:36 PM