Zhang David
05/29/2023, 8:56 PM"The notification block was invalid: KeyError(\"No class found for dispatch key 'slack-incoming-webhook' in registry for type 'Block'.\")"
Has anyone run into this as well ?
Below is the full log:
{
"id": "77b5b58d-e9fa-4fff-bb5b-5c2157314dba",
"account": "94a1563f-c82c-4049-854c-df6f4547b850",
"event": "prefect-cloud.automation.action.failed",
"occurred": "2023-05-29T21:52:20.401Z",
"payload": {
"reason": "The notification block was invalid: KeyError(\"No class found for dispatch key 'slack-incoming-webhook' in registry for type 'Block'.\")",
"invocation": "8ff1536d-55b2-4170-9af4-10d6dd13243f",
"action_type": "send-notification",
"action_index": 0
},
"received": "2023-05-29T21:52:20.401Z",
"related": [],
"resource": {
"prefect.resource.id": "prefect-cloud.automation.fcac6a63-01bb-4ade-94f0-e27664583542",
"prefect-cloud.posture": "Reactive",
"prefect.resource.name": "prod-wf-state"
},
"workspace": "1e3683bb-8412-4b7f-a2a8-c858d613af44"
}
Chris Guidry
05/30/2023, 1:12 PMprefect.blocks.notifications.SlackWebhook
from the core prefect
library (https://github.com/PrefectHQ/prefect/blob/main/src/prefect/blocks/notifications.py#L78) which has the slug slack-webhook
2. The prefect_slack.credentials.SlackWebhook
from the prefect-slack
collection (https://github.com/PrefectHQ/prefect-slack/blob/main/prefect_slack/credentials.py#L51) which has the slug slack-incoming-webhook
For Prefect Cloud automations, we currently only support notification blocks that come from the core prefect
library. We aim to eventually support additional blocks coming from collections libraries, but for now that would mean that you can only use the slack-webhook
with automations. Very sorry for this confusion, we do have an internal issue to improve this situation.Chris Guidry
05/30/2023, 1:13 PMZhang David
05/30/2023, 1:59 PMslack-webhook
a separate app under Blocks if I were to use the cloud GUI ?Chris Guidry
05/30/2023, 2:13 PMSlack Webhook
(and not the one titled Slack Incoming Webhook
) :Luis Cebrián
05/30/2023, 2:15 PMZhang David
05/30/2023, 2:15 PMChris Guidry
05/30/2023, 2:16 PMZhang David
05/30/2023, 2:19 PMZhang David
05/30/2023, 2:19 PMChris Guidry
05/30/2023, 2:30 PMChris Guidry
05/30/2023, 2:31 PM{
"match_related": {
"prefect.resource.name": "name of deployment A",
"prefect.resource.role": "deployment"
},
"expect": [
"prefect.flow-run.Completed"
],
"threshold": 2,
"within": 5400,
"posture": "Reactive",
"actions": [
{
"type": "run-deployment",
"source": "selected",
"deployment_id": "...id of flow b deployment"
}
]
}
Chris Guidry
05/30/2023, 2:34 PMChris Guidry
05/30/2023, 2:36 PMZhang David
05/30/2023, 2:44 PMFirst, the scheduling part should be pretty natural with Prefect 2.0: you'd create two deployments from the two flows and attach their half-hourly and hourly schedules directly to the deployments. That will get you the timing you're looking for.yes ! this I'm currently doing it via the yaml file
Does Flow A produce an artifact when it runs and you want to make sure that Flow B is seeing the latest one of those artifacts? You can use Prefect to create artifacts during your flows, and then query them back in Flow B to find whether there's been a new version of that artifact. You may need to do a little bookkeeping on your depending on what the artifact(s) are.This is very interesting ! so for my actual production use case, for each task, I would on my end take care of all the checkpointing etc to make sure when the job completes, everything is indeed completed, and I'm using prefect task/flow (well task in this case) as a wrapper so that I delegate the workflow scheduling to prefect. are you suggesting something like writing out a success token as an artifact so that when B gets triggered even though now is say 10:00, if in case A takes > 30minutes to run, B would wait until A completes and then run ? that's exactly what I'm trying to achieve, i.e. if A takes more than it should (in this example > 30minutes) to finish, B would wait until A completes then run, instead of just run at 100000
Chris Guidry
05/30/2023, 2:50 PMZhang David
05/30/2023, 2:57 PMI think that approach would work. The only tricky thing is making B wait for the lastest run of A to complete. I think you'd be able to do that by polling the API for an Artifact or the flow run's status.ha - i was just typing to ask if there's a
wait_for
kinda interface exposed... looks like no ?
It does sound like you might want a higher-level flow that coordinates Flow A and Flow B as subflows to make sure the dependencies are metyes - I thought about this, but my question is for the example below:
@flow
def run_A():
pass
@flow
def run_B():
pass
@flow
def run_C():
a = run_A()
b = run_B(wait_for=[a])
how can I prefect deployment apply
A and B w/ two different schedules ?
If I naively do 2 separate applies on run_A
and run_B
, when I run C, wouldn't A be run twice?Chris Guidry
05/30/2023, 3:04 PMZhang David
05/30/2023, 3:12 PMChris Guidry
05/30/2023, 3:18 PMZhang David
05/30/2023, 3:21 PM