https://prefect.io logo
Title
n

Nic

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\_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\utilities\asyncutils.py", 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\asyncutils.py", line 181, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_core\_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_backends\_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\site-packages\anyio\_backends\_asyncio.py", line 287, in wrapper
    return await func(*args)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\x\AppData\Roaming\Python\Python311\site-packages\prefect\cli\deployment.py", line 277, in set_schedule
    rrule_schedule = json.loads(rrule_string)
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", 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?
1
r

Ryan Peden

02/14/2023, 1:29 PM
The
--rrule
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
s

Serina

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 🙂 https://github.com/PrefectHQ/prefect/pull/8543
:party-parrot: 2