https://prefect.io logo
#prefect-community
Title
# prefect-community
t

Torstein Molland

01/09/2023, 3:00 PM
Hi, I'm trying to schedule a deployment using Cron with the following expression
0 0 0 5 JAN,MAR,JUN,SEP,DEC * *
. When I click save I get an error message "Failed to update deployment". How can this be resolved? Thank you in advance! 😊
c

Christopher Boyd

01/10/2023, 2:38 PM
Hi Torstein, can you attempt the same but capture a .har file in developer tools to see the actual response being submitted / received from the UI?
t

Torstein Molland

01/10/2023, 2:41 PM
Hi, thank you for the reply! The request payload is:
Copy code
{
  "schedule": {
    "timezone": "UTC",
    "cron": "0 0 0 5 JAN,MAR,JUN,SEP,DEC * *",
    "day_or": false
  }
}
And the response payload is:
Copy code
{
  "exception_message": "Invalid request received.",
  "exception_detail": [
    {
      "loc": [
        "body",
        "schedule",
        "interval"
      ],
      "msg": "field required",
      "type": "value_error.missing"
    },
    {
      "loc": [
        "body",
        "schedule",
        "cron"
      ],
      "msg": "extra fields not permitted",
      "type": "value_error.extra"
    },
    {
      "loc": [
        "body",
        "schedule",
        "day_or"
      ],
      "msg": "extra fields not permitted",
      "type": "value_error.extra"
    },
    {
      "loc": [
        "body",
        "schedule",
        "cron"
      ],
      "msg": "Invalid cron string: \"0 0 0 5 JAN,MAR,JUN,SEP,DEC * *\"",
      "type": "value_error"
    },
    {
      "loc": [
        "body",
        "schedule",
        "rrule"
      ],
      "msg": "field required",
      "type": "value_error.missing"
    },
    {
      "loc": [
        "body",
        "schedule",
        "cron"
      ],
      "msg": "extra fields not permitted",
      "type": "value_error.extra"
    },
    {
      "loc": [
        "body",
        "schedule",
        "day_or"
      ],
      "msg": "extra fields not permitted",
      "type": "value_error.extra"
    }
  ],
  "request_body": {
    "schedule": {
      "timezone": "UTC",
      "cron": "0 0 0 5 JAN,MAR,JUN,SEP,DEC * *",
      "day_or": false
    }
  }
}
c

Christopher Boyd

01/10/2023, 2:44 PM
Hi Torstein, thank you - do you possibly have the .har attachment as well to review?
Can you try this:
0 0 5 1,3,6,9,12 0
ah, one second, missed. a flag, that’s an OR not an and
message has been deleted
t

Torstein Molland

01/10/2023, 3:04 PM
That cron string works, but it seems to produce a different schedule than the one in my first picture. It should execute
At 12:00 AM on day 5 of the month, only in January, March, June, September, and December
the query you suggested will execute
At 12:00 AM on Sunday and on day 5 of the month, only in January, March, June, September, and December
c

Christopher Boyd

01/10/2023, 3:05 PM
that’s the 0 at the end which is day of the week, it should be *
🎉 1
t

Torstein Molland

01/10/2023, 3:05 PM
Oh right, I didn't catch that, this works, yes thank you!
🙌 1