https://prefect.io logo
s

Solmaz Bagherpour

09/09/2022, 7:36 PM
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
s

Serina

09/09/2022, 7:50 PM
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
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! πŸŽ‰πŸ™
πŸš€ 1
πŸŽ‰ 1
3 Views