Frederick Thomas
03/13/2021, 4:42 PMimport requests
import os
def vent(flow:str,state:str):
msg = "Flow {0} finished in fail state '{1}'".format(flow, state)
g = os.environ.get("TEAMS_NOTIFICATION")# webhook link to Outlook for Teams
<http://requests.post|requests.post>(g, json={"text": msg})
check = lambda flow,state:vent(flow.name,state.message)
.
.
.
with Flow(flow_name, schedule=None,on_failure=check) as flow:
Which is probably not optimal but I just found the API and I don't have the time to tuck in at the moment. Any help is greatly appreciated. Thanks.Dylan
Dylan
Dylan
<https://cloud.prefect.io/prefect/flow-run/{YOUR_FLOW_RUN_ID}>
Frederick Thomas
03/15/2021, 6:56 PMdef vent(flow,state):
msg = f"More Testing - Flow {flow.name} finished in fail state '{state.message}' for more information refer to : <http://172.18.1.5:8080/default/flow-run/{context.context.flow_run_id}?logs=>"
<http://requests.post|requests.post>(url=prefect.config.p.teams_notification, json={"text": msg})
check = lambda flow,state:vent(flow,state)
Once again, thanks.Dylan
Frederick Thomas
03/15/2021, 7:09 PM# prefect version
0.12.6
Dylan
Frederick Thomas
03/15/2021, 7:24 PMDylan
Dylan
Dylan
Dylan
Dylan
query {
flow_by_pk(id: "your_flow_id") {
id
name
version
project {
id
name
}
}
}
Dylan
.graphql
method https://docs.prefect.io/api/latest/client/client.html#client-2