02/14/2023, 9:45 AM
When i try to set schedule with rrule from CLI like
prefect deployment set-schedule name --rrule "FREQ=DAILY;INTERVAL=10;COUNT=5"
I get following Error
Traceback (most recent call last):
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\cli\", line 41, in wrapper
    return fn(*args, **kwargs)
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\utilities\", line 230, in coroutine_wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\utilities\", line 181, in run_async_in_new_loop
    return, *args, **kwargs))
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_core\", line 70, in run
    return, *args, **backend_options)
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_backends\", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "C:\Program Files\Python311\Lib\asyncio\", line 190, in run
  File "C:\Program Files\Python311\Lib\asyncio\", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Program Files\Python311\Lib\asyncio\", line 653, in run_until_complete
    return future.result()
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_backends\", line 287, in wrapper
    return await func(*args)
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\cli\", line 277, in set_schedule
    rrule_schedule = json.loads(rrule_string)
  File "C:\Program Files\Python311\Lib\json\", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\Python311\Lib\json\", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\Python311\Lib\json\", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
An exception occurred.
I can make it work with interval and cron - what am i doing wrong here?

Ryan Peden

02/14/2023, 1:29 PM
flag was updated to require a JSON string, but it doesn't look like this is mentioned in the deployment docs. This should work:
prefect deployment set-schedule name --rrule "{\"rrule\": \"FREQ=DAILY;INTERVAL=10;COUNT=5\"}"
👍 1


02/16/2023, 7:14 PM
Hi @Nic, we also just released an enhancement for this so now you can pass a valid rrule string 🙂
:party-parrot: 2