Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RRule should be a JSON string rather than rrule string #6839

Closed
4 tasks done
anna-geller opened this issue Sep 15, 2022 · 0 comments · Fixed by #7133
Closed
4 tasks done

RRule should be a JSON string rather than rrule string #6839

anna-geller opened this issue Sep 15, 2022 · 0 comments · Fixed by #7133
Assignees
Labels
bug Something isn't working component:cli Related to the Prefect CLI status:accepted We may work on this; we will accept work from external contributors

Comments

@anna-geller
Copy link
Contributor

anna-geller commented Sep 15, 2022

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Prefect documentation for this issue.
  • I checked that this issue is related to Prefect and not one of its dependencies.

Bug summary

The fix applied to "build CLI" from #6761 should also be applied to "set-schedule" CLI:

prefect deployment set-schedule flow/deployment \
--rrule '''{"rrule": "DTSTART:20220921T110000\nRRULE:FREQ=DAILY;COUNT=7;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9", "timezone": "Europe/Berlin"}'

Otherwise, any rule that has a start date (DTSTART), e.g.:

prefect deployment set-schedule healthcheck/prod --timezone 'Europe/Berlin' \
--rrule 'DTSTART:20220921T110000\nRRULE:FREQ=DAILY;COUNT=7;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9'

will raise the same RRule ValidationError as in #6739

cc @anticorrelator

Error

Traceback (most recent call last):
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
    return fn(*args, **kwargs)
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 212, in wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/prefect/utilities/asyncutils.py", line 141, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/opt/miniconda3/envs/201/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/opt/miniconda3/envs/201/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/prefect/cli/deployment.py", line 226, in set_schedule
    await client.update_deployment(deployment, schedule=updated_schedule)
  File "/opt/miniconda3/envs/201/lib/python3.9/site-packages/prefect/client.py", line 1385, in update_deployment
    deployment_create = schemas.actions.DeploymentUpdate(
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 5 validation errors for DeploymentUpdate
schedule -> interval
  field required (type=value_error.missing)
schedule -> rrule
  extra fields not permitted (type=value_error.extra)
schedule -> cron
  field required (type=value_error.missing)
schedule -> rrule
  extra fields not permitted (type=value_error.extra)
schedule -> rrule
  Invalid RRule string "DTSTART:20220921T110000\nRRULE:FREQ=DAILY;COUNT=7;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9": Unknown string format: 20220921T110000\NRRULE:FREQ=DAILY;COUNT=7;BYDAY=MO (type=value_error)
An exception occurred.

Versions

Version:             2.4.0
API version:         0.8.0
Python version:      3.9.12
Git commit:          513639e8
Built:               Tue, Sep 13, 2022 2:15 PM
OS/Arch:             darwin/arm64
Profile:             dev
Server type:         cloud
@anna-geller anna-geller added bug Something isn't working status:triage component:cli Related to the Prefect CLI and removed status:triage labels Sep 15, 2022
@anticorrelator anticorrelator self-assigned this Oct 5, 2022
@billpalombi billpalombi added the v2 label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:cli Related to the Prefect CLI status:accepted We may work on this; we will accept work from external contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants