Sean Harkins
07/20/2021, 5:14 PMCloud Hook
for the Flow success
event. This needs to be done programmatically via the api at registration time. The documentation states Psst! We have recently added Automations which offer more functionality than Cloud Hooks and will eventually replace them.
There does not seem to currently be programmatic api access to Automations.
1. Is there a way to register an Automation via an API and if so is it documented somewhere?
2. When is the planned deprecation of Cloud Hooks? We will need to support a mix of self hosted Prefect Server instances and Prefect Cloud usage so we would like a solution which supports both but it appears that Automations will not be available via Prefect Server.Jenny
07/20/2021, 5:28 PMSean Harkins
07/20/2021, 5:29 PMJenny
07/20/2021, 5:32 PMJenny
07/20/2021, 6:19 PMSean Harkins
07/20/2021, 6:23 PMJenny
07/20/2021, 6:24 PMJenny
07/20/2021, 6:42 PMSean Harkins
07/21/2021, 9:42 PMJenny
07/22/2021, 10:09 PMmutation {
test_action (input: {action_id: ""}){
success
}
}
Sean Harkins
07/23/2021, 1:18 PMSean Harkins
07/23/2021, 3:20 PMJenny
07/23/2021, 7:59 PMJenny
07/23/2021, 8:00 PMSean Harkins
07/23/2021, 8:08 PMJenny
07/23/2021, 8:33 PMSean Harkins
07/23/2021, 8:35 PMSean Harkins
07/23/2021, 8:35 PMJenny
07/23/2021, 9:31 PMSean Harkins
08/13/2021, 6:54 PMSean Harkins
08/13/2021, 6:56 PMcreate_flow_run_state_changed_hook
but nothing for deleting or updating.Jenny
08/13/2021, 7:01 PMdelete_hook
and delete_action
mutations. I'm about to head into a meeting but I can send an example in a bit.Sean Harkins
08/13/2021, 7:02 PMJenny
08/13/2021, 9:04 PMquery {
hook {
id
event_tags
action {
id
}
created
}
}
Jenny
08/13/2021, 9:05 PMmutation {
delete_hook (input: {hook_id: "12dd1e90-46b4-4962-a142-272603b454f6"}) {
success
}
}
Jenny
08/13/2021, 9:06 PMJenny
08/13/2021, 9:09 PMmutation {
delete_action (input: {action_id: "811add75-9b76-4228-aee6-87ba94d6d253"}) {
success
}
}
Of course, replace those IDs with what you get returned from your query.Sean Harkins
08/16/2021, 3:48 PMhook_query = {
"query": {
with_args(
"hook", {"where": {"event_tags": {"_contains": {"flow_group_id": [flow_group_id]}}}}
): {
"id"
}
}
}
Sean Harkins
08/16/2021, 3:49 PMJenny
08/16/2021, 4:58 PMquery = """
query {
hook {
id
event_tags
action {
id
}
}
}
"""
You could also use variable to filter:
query = """
query ($etContains: jsonb){
hook (where: {event_tags: {_contains: $etContains}}) {
id
event_tags
action {
id
}
}
}
"""
variables={'etContains': 'xxxxx'}
client.graphql(
query, variables=variables
)
But heads up that I found that query filtered out all my hooks so you may be better leaving that out and do a post query filter.