Skip to content

[feature] Wire persistent-mass-upgrade Beat tasks into docker stack #623#628

Open
Eeshu-Yadav wants to merge 2 commits into
gsoc26-persistent-scheduled-upgradesfrom
gsoc26/wire-persistent-upgrade-beat-tasks
Open

[feature] Wire persistent-mass-upgrade Beat tasks into docker stack #623#628
Eeshu-Yadav wants to merge 2 commits into
gsoc26-persistent-scheduled-upgradesfrom
gsoc26/wire-persistent-upgrade-beat-tasks

Conversation

@Eeshu-Yadav
Copy link
Copy Markdown
Contributor

@Eeshu-Yadav Eeshu-Yadav commented Jun 2, 2026

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

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_upgrades and send_pending_upgrade_reminders), and images/common/openwisp/celery.py merges 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.

  • A firmware_schedule block lands alongside the existing monitoring_schedule, radius_schedule, etc. Gated on the same USE_OPENWISP_FIRMWARE + USE_OPENWISP_CELERY_FIRMWARE envs that gate the firmware task routes today, so disabling either env hides both the routes and the schedule.
  • Two new env vars let operators tune cadence without rebuilding: OPENWISP_FIRMWARE_CHECK_PENDING_PERIOD_MINUTES (default 10, the retry-scan period) and OPENWISP_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 by OPENWISP_FIRMWARE_UPGRADER_PERSISTENT_REMINDER_PERIOD, default 60 days.
  • test_celery in tests/runtests.py now 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.
  • Settings doc entries added next to OPENWISP_CELERY_FIRMWARE_COMMAND_FLAGS.

The second commit ([chores] TEMPORARY pin openwisp-firmware-upgrader to gsoc26 branch) is what it says on the tin: flips OPENWISP_FIRMWARE_SOURCE to 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.

Copilot AI review requested due to automatic review settings June 2, 2026 07:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5dda31b4-fc0a-4584-9ad6-f2b034479c69

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gsoc26/wire-persistent-upgrade-beat-tasks

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_MINUTES and OPENWISP_FIRMWARE_REMINDER_SCAN_PERIOD_DAYS in the base image, .env, and documentation.
  • Extend tests/runtests.py::test_celery to 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}
Comment thread images/openwisp_base/Dockerfile Outdated
# 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"
Comment on lines +44 to +49
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")
)
@openwisp-companion
Copy link
Copy Markdown

Docker Build Failure and Doc Formatting Error

Hello @Eeshu-Yadav,
(Analysis for commit 5e9803a)

  1. Build Failure: The openwisp-firmware-upgrader installation failed due to an invalid package name format in the Dockerfile. The @ symbol is not a valid part of a package name when installing from a Git repository.
  • Fix: Remove the @ symbol from the OPENWISP_FIRMWARE_SOURCE argument in the images/openwisp_base/Dockerfile on line 47. It should be openwisp-firmware-upgrader git+https://github.com/openwisp/openwisp-firmware-upgrader.git@gsoc26-persistent-scheduled-upgrades.
  1. Documentation Formatting: The docs/user/settings.rst file has formatting issues that were detected by the ReStructuredText check.
  • Fix: Please reformat the docs/user/settings.rst file. You can typically fix this by running a documentation formatting tool or by manually adjusting the line breaks and spacing to adhere to ReStructuredText conventions.

@Eeshu-Yadav Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch from 5e9803a to 2d65990 Compare June 2, 2026 07:35
@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3).

@openwisp-companion
Copy link
Copy Markdown

Docker Build Failure: Git Command Not Found

Hello @Eeshu-Yadav,
(Analysis for commit 2d65990)

The CI build failed because the Docker image build process could not find the git command. This is required to install the openwisp-firmware-upgrader package from source.

Fix:

Ensure that git is installed in the openwisp_base Docker image. You can do this by adding git to the apt-get install command in the images/openwisp_base/Dockerfile.

Specifically, modify the RUN apt-get update && apt-get install ... command to include git.

…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
@Eeshu-Yadav Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch from 2d65990 to 4b67b61 Compare June 2, 2026 07:56
@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3).

@Eeshu-Yadav Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch from 4b67b61 to 99088d0 Compare June 2, 2026 10:43
… 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
@Eeshu-Yadav Eeshu-Yadav force-pushed the gsoc26/wire-persistent-upgrade-beat-tasks branch from 99088d0 to 54fb1e9 Compare June 2, 2026 10:43
@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion
Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants