https://prefect.io logo
m

Mac Gréco Péralte Chéry

07/17/2020, 5:41 AM
Hello, everyone i am trying to pause an unpause the schedule of a flow using the setFlowScheduleState mutation as defined in the documentation by using this graphl code:
Copy code
mutation {
  setFlowScheduleState(input: { flow_id: "<flow id>", set_active: true }) {
    success
  }
}
but i get this error:
Copy code
{
  "graphQLErrors": [],
  "networkError": {
    "name": "ServerError",
    "response": {},
    "statusCode": 400,
    "result": {
      "errors": [
        {
          "message": "Cannot query field \"setFlowScheduleState\" on type \"Mutation\". Did you mean \"set_schedule_active\", \"set_flow_run_states\", or \"set_schedule_inactive\"?",
          "locations": [
            {
              "line": 2,
              "column": 3
            }
          ],
          "extensions": {
            "code": "GRAPHQL_VALIDATION_FAILED"
          }
        }
      ]
    }
  },
  "message": "Network error: Response not successful: Received status code 400"
}
👀 1
j

Jenny

07/17/2020, 11:08 AM
Hi @Mac Gréco Péralte Chéry - looks like you've found a section of the docs that we need to update. The set_schedule_active and set_schedule_inactive mutations should work for pausing and unpausing your schedule. I'll create a ticket to update the docs there - thanks for pointing it out to us.
m

Mac Gréco Péralte Chéry

07/17/2020, 3:44 PM
@Jenny Thank you Jenny. I my version of prefect running this code
Copy code
mutation {
  set_schedule_active(input: {
    flow_id: "<flow_id>"
  }) {
    success
  }
}
gives me this error
Copy code
{
  "graphQLErrors": [],
  "networkError": {
    "name": "ServerError",
    "response": {},
    "statusCode": 400,
    "result": {
      "errors": [
        {
          "message": "Field set_schedule_active_input.schedule_id of required type UUID! was not provided.",
          "locations": [
            {
              "line": 2,
              "column": 30
            }
          ],
          "extensions": {
            "code": "GRAPHQL_VALIDATION_FAILED"
          }
        },
        {
          "message": "Field \"flow_id\" is not defined by type set_schedule_active_input.",
          "locations": [
            {
              "line": 2,
              "column": 31
            }
          ],
          "extensions": {
            "code": "GRAPHQL_VALIDATION_FAILED"
          }
        }
      ]
    }
  },
  "message": "Network error: Response not successful: Received status code 400"
}
I am using prefect 0.12.1
j

Jenny

07/17/2020, 3:46 PM
Let me check that for you @Mac Gréco Péralte Chéry
I can't recreate this issue @Mac Gréco Péralte Chéry . One suggestion would be to try giving the schedule id so running a mutation like this:
mutation {
set_schedule_inactive(input: {
flow_id: "xxx",
schedule_id: "xxx"
}) {
success
error
}
}
m

Mac Gréco Péralte Chéry

07/17/2020, 5:04 PM
That dont works too, in the mutation docs there is only a schedule_id parameter for this mutation
🤔 1
j

Jenny

07/17/2020, 5:28 PM
Oh @Mac Gréco Péralte Chéry - are you using Sever or Cloud? If it only says schedule_id, then let's only use schedule_id:
mutation {
set_schedule_inactive(input: {
schedule_id: "xxx"
}) {
success
error
}
}
Let me know if that works!
m

Mac Gréco Péralte Chéry

07/17/2020, 7:44 PM
I am using prefect Core Server. I think it will works but for my use case i need to be able to active/inactive the schedule via a mutation that has only the flow_id as parameter (not the schedule id). my end user are interacting with prefect via another php web application via grapql api call .In the web app database i store the flow_uid when the user register (via the php web app) a new flow. I use only this flow_uid to interact with the flow on the prefect server.
j

Jenny

07/17/2020, 9:17 PM
Ah yes, I was thinking of Cloud and now I've spun up server I see your issue. You could get the schedule id by adding a query for your flow. Or feel free to open an issue to request that we add a way to access this mutation by flow_id in server too.