Hi everyone I have 2 scheduler time in a flow, how...
# ask-community
r
Hi everyone I have 2 scheduler time in a flow, how to show all scheduler time via graphql? Because when i run this graphql, only show the read-only scheduler.
Copy code
{
  flow{
    id
    name
    schedule
  }
}
And the result is:
Copy code
{
        "id": "86f5fb6f-26c9-4ffe-9961-f28e5538b53b",
        "name": "spark",
        "schedule": {
          "type": "Schedule",
          "clocks": [
            {
              "cron": "0 1 * * *",
              "type": "CronClock",
              "day_or": true,
              "labels": null,
              "end_date": null,
              "start_date": null,
              "__version__": "0.14.13",
              "parameter_defaults": {}
            }
          ],
          "filters": [],
          "or_filters": [],
          "__version__": "0.14.13",
          "adjustments": [],
          "not_filters": []
        }
n
Hi @Ria May Dewi - the other clock is attached to the flow's group, which is an object that persists between versions of your flow. You can find that schedule with this query:
Copy code
query {
  flow_group {
    id
    schedule
  }
}
r
I got it, thanks for helping @nicholas Btw, i have another problem. How to execute this graphql using graphql client in python?
Copy code
mutation {
  set_flow_group_schedule(input :{
    flow_group_id: "8d413fc1-5a18-4ae8-a9af-9507c3d0b6ed",
    cron_clocks: [{cron: "0 4 * * *"}],
    timezone:"UTC"
  }) {
    success
  }
}
n
You can create a client like this:
Copy code
from prefect.client import Client

client = Client()
client.query("<<your query>>")
r
I've tried it, this is my code
Copy code
query = {
    "mutation": {
        with_args("set_flow_group_schedule", {
            "input": {
                        "flow_group_id": "b9b8f256-64a6-4438-a19b-0ce964121af8",
                        'cron_clocks': [{cron: "0 4 * * *"}],
                        "timezone": "UTC",
                    }
                }): 
                {
                    "success" : True
                }
                }
        }

result = client.graphql(query)
print(result)
And i get the error message like this:
NameError: name 'cron' is not defined
j
you have a variable named
cron
as a key, you probably meant this to be a string as
{"cron": "0 4 * * *"}
r
wow thanks @Jim Crist-Harif, it's worked
Hi @Jim Crist-Harif, how to use
order_by: desc
in graphql client? I have an error like this
Copy code
GRAPHQL_VALIDATION_FAILED: Expected type order_by, found "desc". Did you mean
        the enum value desc?
j
Wrap
desc
in `prefect.utilities.graphql.EnumValue`:
Copy code
{"order_by": EnumValue("desc")}
🙌 1