Hi prefect community,
I am looking for a way to set up a slack alert for flows that their runtimes pass a certain expected time while the flow is still running, would appreciate your suggestions or best ways to achieve this, We are on prefect 1 and we use python for our flow runs and we already have slack alerts for failed runs but that is using flow run state changes which is not useful for this case.
β 1
r
Rob Freedy
09/09/2022, 7:47 PM
You could use some custom logic with the prefect context values
You could also use GraphQL to see which flows are running as well, if youβre interested in observing run times for all flows
π 1
s
Solmaz Bagherpour
09/10/2022, 12:25 AM
Thank you for the suggestions, @Serina I like the GraphQl idea for all flows, I tried the graphql UI and I composed the query and I get the expected results, when I try to replicate the same thing in python, I am not sure if I am setting all the required params correctly for the client().
I used this code:
Copy code
from prefect import Client
client = Client(api_key="our cloud API key")
response = client.graphql("my exact query string that works on UI")
print(response)
Passing our cloud API key to the client as param and it times out after retries, so I suspect I am still missing some other params or settings maybe. (I am running this locally on a container) any guidance here?
s
Serina
09/10/2022, 12:28 AM
Do you have multiple tenants? You may want to try running
client.tenant_id
to determine the default tenant associated with the API key
Serina
09/10/2022, 12:29 AM
regardless, you could try passing in a
tenant_id
arg in
Client
s
Solmaz Bagherpour
09/10/2022, 12:39 AM
oh wow, it worked π Thank you so much for your help! ππ
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.