Open
Conversation
* Fix incorrect crontab dependency. When both Celery and rq-scheduler are installed they are using two different crontab libraries, but both have the same crontab module name. This is causing errors and prevents the dual-queue configuration from functioning. Root Cause There are two different packages on PyPI with similar names: crontab (https://pypi.org/project/crontab/) - A different cron scheduling library python-crontab (https://pypi.org/project/python-crontab/) - The correct package for reading/writing system crontabs * Update workflow matrix for Python and Redis versions * Update Ubuntu version in workflow configuration * Change installation command to use pip install * Refactor crontab handling to use croniter for scheduling and update dependencies * Update crontab dependency to pychronotab * `pychronotab` is a drop-in replacement with full croniter API compatibility and active maintenance. * Eliminates namespace conflicts when using multiple schedulers on the same system (e.g., django-celery-beat with `python-crontab` and rq-scheduler). * `pychronotab` keeps `crontab`, `croniter`, and other package names at a lower level to avoid top-level import conflicts. * All 75 tests passing with the new implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the scheduler's cron handling by switching from the
crontablibrary topychronotab, modernizes the CI workflow, and improves test compatibility with newer RQ versions.When both django-celery-beat and rq-scheduler are installed they are using two different crontab libraries, but both have the same crontab module name. This is causing errors and prevents the dual-queue configuration from functioning.
pychronotabis a drop-in replacement with full croniter API compatibility and active maintenance.python-crontaband rq-scheduler).pychronotabkeepscrontab,croniter, and other package names at a lower level to avoid top-level import conflicts.Cron Parsing and Scheduling Updates:
crontablibrary withpychronotabfor cron expression parsing inrq_scheduler/utils.py, updating logic to usecroniterand handle timezone-aware datetimes. [1] [2]tests/test_scheduler.pyto use UTC consistently for cron scheduling and adjusted cron string format to 5 fields for compatibility. [1] [2]Dependency and Workflow Modernization:
setup.pyto requirepychronotabinstead ofcrontab.Test Suite Compatibility Improvements:
tests/test_callbacks.pyto be compatible with internal changes in newer RQ versions by relaxing internal state assertions. [1] [2]tearDownmethod totests/test_scheduler.pyfor improved test reliability and mocking. [1] [2]* Fix incorrect crontab dependency.