[feature] Wire persistent-mass-upgrade Beat tasks into docker stack #623#628
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR wires the new persistent mass-upgrade Celery Beat tasks from openwisp-firmware-upgrader into the docker-openwisp Celery app, exposing operator-tunable scheduling via environment variables and extending the Celery task registration regression test to cover the new tasks.
Changes:
- Add firmware-related Beat schedule entries (
check_pending_upgrades,send_pending_upgrade_reminders) gated behind existing firmware enable flags. - Expose scheduling cadence via
OPENWISP_FIRMWARE_CHECK_PENDING_PERIOD_MINUTESandOPENWISP_FIRMWARE_REMINDER_SCAN_PERIOD_DAYSin the base image,.env, and documentation. - Extend
tests/runtests.py::test_celeryto assert the new firmware upgrader tasks are registered.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
images/common/openwisp/celery.py |
Adds firmware Beat schedule entries and merges them into beat_schedule. |
images/openwisp_base/Dockerfile |
Exposes new firmware schedule env defaults; temporarily pins firmware-upgrader source. |
tests/runtests.py |
Updates Celery task registration assertions to include new firmware tasks. |
docs/user/settings.rst |
Documents the two new firmware scheduling environment variables. |
.env |
Adds defaults for the new firmware scheduling environment variables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ARG OPENWISP_FIRMWARE_SOURCE="openwisp-firmware-upgrader~=1.2.0" | ||
| ARG OPENWISP_FIRMWARE_SOURCE="openwisp-firmware-upgrader @ git+https://github.com/openwisp/openwisp-firmware-upgrader.git@gsoc26-persistent-scheduled-upgrades" | ||
| # hadolint ignore=DL3013 | ||
| RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_FIRMWARE_SOURCE} |
| # hadolint ignore=DL3013 | ||
| RUN pip install --no-cache-dir --user --upgrade ${OPENWISP_MONITORING_SOURCE} | ||
| ARG OPENWISP_FIRMWARE_SOURCE="openwisp-firmware-upgrader~=1.2.0" | ||
| ARG OPENWISP_FIRMWARE_SOURCE="openwisp-firmware-upgrader @ git+https://github.com/openwisp/openwisp-firmware-upgrader.git@gsoc26-persistent-scheduled-upgrades" |
| check_pending_minutes = int( | ||
| os.environ.get("OPENWISP_FIRMWARE_CHECK_PENDING_PERIOD_MINUTES", "10") | ||
| ) | ||
| reminder_scan_days = int( | ||
| os.environ.get("OPENWISP_FIRMWARE_REMINDER_SCAN_PERIOD_DAYS", "7") | ||
| ) |
Docker Build Failure and Doc Formatting ErrorHello @Eeshu-Yadav,
|
5e9803a to
2d65990
Compare
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3). |
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3). |
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3). |
Docker Build Failure: Git Command Not FoundHello @Eeshu-Yadav, The CI build failed because the Docker image build process could not find the Fix: Ensure that Specifically, modify the |
…ders into the Beat schedule #623 Added a firmware_schedule alongside the existing per-module schedules in images/common/openwisp/celery.py, gated on USE_OPENWISP_FIRMWARE and USE_OPENWISP_CELERY_FIRMWARE. Cadences read from two new env vars, OPENWISP_FIRMWARE_CHECK_PENDING_PERIOD_MINUTES (default 10) and OPENWISP_FIRMWARE_REMINDER_SCAN_PERIOD_DAYS (default 7), exposed in .env and the openwisp_base Dockerfile. Documented both env vars in docs/user/settings.rst. Extended the test_celery assertion in tests/runtests.py with the three new task names (check_pending_upgrades, retry_pending_upgrade, send_pending_upgrade_reminders). Related to #623
2d65990 to
4b67b61
Compare
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3). |
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3). |
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3). |
4b67b61 to
99088d0
Compare
… revert before merge CI on this integration branch installs openwisp-firmware-upgrader~=1.2.0 from PyPI, which does not yet ship the three new tasks. Without this pin the new Beat entries and the test_celery assertion both fail. Points at the openwisp-firmware-upgrader branch issues/417-persistence-schema-fields (the PR #436 head), via the tarball URL so pip does not need git in the slim base image. Revert this to openwisp-firmware-upgrader~=1.2.0 (or the next released version) as the final commit before this branch merges to master, once PR #436 has merged and a release is cut. Related to #623
99088d0 to
54fb1e9
Compare
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3). |
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3). |
Checklist
Reference to Existing Issue
Closes #623.
Related to openwisp/openwisp-firmware-upgrader#379 (parent — Persistent Mass Upgrades) and openwisp/openwisp-firmware-upgrader#436 (upstream implementation).
Description of Changes
Once openwisp-firmware-upgrader ships the persistent-mass-upgrades feature, a docker install still won't fire its retry loop or its reminder notifications. The new behaviour rides on two Celery Beat tasks (
check_pending_upgradesandsend_pending_upgrade_reminders), andimages/common/openwisp/celery.pymerges per-module Beat dicts but doesn't have a firmware one. Only the task routes are wired up. Operators would install the new release and quietly get none of the new behaviour.This PR adds the missing schedule.
firmware_scheduleblock lands alongside the existingmonitoring_schedule,radius_schedule, etc. Gated on the sameUSE_OPENWISP_FIRMWARE+USE_OPENWISP_CELERY_FIRMWAREenvs that gate the firmware task routes today, so disabling either env hides both the routes and the schedule.OPENWISP_FIRMWARE_CHECK_PENDING_PERIOD_MINUTES(default 10, the retry-scan period) andOPENWISP_FIRMWARE_REMINDER_SCAN_PERIOD_DAYS(default 7, how often the reminder task looks at long-running batches). The per-batch reminder cadence stays controlled upstream byOPENWISP_FIRMWARE_UPGRADER_PERSISTENT_REMINDER_PERIOD, default 60 days.test_celeryintests/runtests.pynow expects three more registered tasks:check_pending_upgrades,retry_pending_upgrade,send_pending_upgrade_reminders. If a future change drops the wiring, CI flags it instead of leaving the feature silently dead on prod.OPENWISP_CELERY_FIRMWARE_COMMAND_FLAGS.The second commit (
[chores] TEMPORARY pin openwisp-firmware-upgrader to gsoc26 branch) is what it says on the tin: flipsOPENWISP_FIRMWARE_SOURCEto the upstream gsoc26 branch so CI on this integration branch installs a version that actually ships the new tasks. Must be reverted to a released-version pin as the final commit before this branch merges to master.