Skip to content

Comments

[docs] GSoC26: Resource Aware Priority Task Scheduling for OpenWISP#269

Merged
nemesifier merged 2 commits intomasterfrom
gsoc26-monitoring-scalability
Feb 15, 2026
Merged

[docs] GSoC26: Resource Aware Priority Task Scheduling for OpenWISP#269
nemesifier merged 2 commits intomasterfrom
gsoc26-monitoring-scalability

Conversation

@nemesifier
Copy link
Member

GSoC26: Resource Aware Priority Task Scheduling for OpenWISP

@nemesifier nemesifier self-assigned this Feb 14, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

Walkthrough

Adds a new GSoC 2026 project idea "Resource Aware Priority Task Scheduling for OpenWISP" describing a three-component architecture (Resource Monitor, Resource Autoscaler, Priority Scheduler) for resource-aware, priority-based Celery task execution and migration to gevent-based I/O concurrency. The proposal includes rationale, problem statements, concrete goals, architecture sketches, migration guidance, success criteria, milestones, prerequisites, open questions, and duplicated content in the document. Also adds ten words to the spelling wordlist (async, autoscaler, autoscaling, benchmarking, bootsteps, filesystems, gevent, PoC, greenlets, prefetch, quickstart).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Scheduler as Priority Scheduler
participant Monitor as Resource Monitor
participant Autoscaler as Resource Autoscaler
participant Celery as Celery Workers
participant DB as Database
Scheduler->>Monitor: Request current resource metrics
Monitor-->>Scheduler: Return metrics (CPU, memory, network, queue lengths)
Scheduler->>DB: Read task priorities and queue state
DB-->>Scheduler: Return tasks and priorities
Scheduler->>Celery: Dispatch tasks respecting priorities
Celery-->>Scheduler: Report task execution status
Monitor->>Autoscaler: Send aggregated resource usage and queue pressure
Autoscaler-->>Monitor: Acknowledge metrics
Autoscaler->>Celery: Scale up/down worker pool or adjust concurrency
Celery-->>Autoscaler: Confirm scaling actions

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding GSoC26 documentation for a resource-aware priority task scheduling project for OpenWISP.
Description check ✅ Passed The description relates to the changeset by identifying the project being documented, though it lacks detail about the specific changes made to files.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gsoc26-monitoring-scalability

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
developer/gsoc-ideas-2026.rst (1)

1204-1207: Fix anchor label to match 2026.

gsoc16-resource-aware-priority-scheduling looks like a year typo and may break cross-references for 2026.

✏️ Proposed fix
-.. _gsoc16-resource-aware-priority-scheduling:
+.. _gsoc26-resource-aware-priority-scheduling:
📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70ada53 and fd31af6.

⛔ Files ignored due to path filters (1)
  • images/gsoc/ideas/2026/celery-priority-resource-aware.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • developer/gsoc-ideas-2026.rst
  • general/roadmap-2030.rst
  • spelling_wordlist.txt
✅ Files skipped from review due to trivial changes (1)
  • general/roadmap-2030.rst
🚧 Files skipped from review as they are similar to previous changes (1)
  • spelling_wordlist.txt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@developer/gsoc-ideas-2026.rst`:
- Line 1207: Update the image reference string in the RST at the shown diff:
replace the misspelled filename
"../images/gsoc/ideas/2026/celery-priority-reseource-aware.png" with the
correctly spelled "../images/gsoc/ideas/2026/celery-priority-resource-aware.png"
so the image loads; ensure any other occurrences of "reseource" in the document
are corrected too.
- Around line 1497-1503: The bash code block contains RST inline code markup
(double backticks) around sysctl on the lines that set ping_group_range; remove
the backticks so the commands use plain sysctl and the filename /etc/sysctl.conf
as normal shell tokens (i.e., change ``sysctl`` to sysctl and
``/etc/sysctl``.conf to /etc/sysctl.conf) in the code-block so copy-pasting will
produce valid shell commands; verify the two affected lines reference
net.ipv4.ping_group_range and the sysctl invocation without any backticks.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51fb801 and 2d9d954.

⛔ Files ignored due to path filters (1)
  • images/gsoc/ideas/2026/celery-priority-reseource-aware.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • developer/gsoc-ideas-2026.rst
  • spelling_wordlist.txt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
spelling_wordlist.txt (1)

8-250: LGTM!

All added words are correctly alphabetized and are valid technical terms relevant to the GSoC project on Celery, gevent, and task scheduling.

developer/gsoc-ideas-2026.rst (1)

1204-1687: Well-structured and comprehensive project documentation.

The GSoC project idea is thoroughly documented with clear problem statement, goals, architecture, migration guidance, success criteria, and prerequisites. The technical content is accurate, including:

  • Correct identification of gevent/Celery integration challenges
  • Accurate code examples for ResourceMonitor, ResourceAutoscaler, and PriorityScheduler patterns
  • Valid migration guidance from fping to icmplib
  • Proper handling of Django database connection issues with gevent

The document follows OpenWISP documentation conventions with appropriate RST formatting, clear section hierarchy, and comprehensive coverage of requirements and deliverables.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@nemesifier nemesifier force-pushed the gsoc26-monitoring-scalability branch from 2d9d954 to 70ada53 Compare February 14, 2026 21:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@developer/gsoc-ideas-2026.rst`:
- Around line 1630-1634: The RST numbered list under "Implementation Phase
(Coding Period)" is run together; fix it by converting the single inline
sentence starting "Priority order (must-haves first): 1. Core priority scheduler
package 2. OpenWISP Monitoring ``gevent`` migration 3. Integration & testing 4.
Documentation" into a proper reStructuredText numbered list: place a blank line
after the heading, then put each item on its own line prefixed with its number
and a period (e.g., "1. Core priority scheduler package", "2. OpenWISP
Monitoring ``gevent`` migration", etc.), ensuring consistent indentation and
spacing so the parser recognizes the list.
- Around line 1449-1456: Update the Django gevent/persistent-connections section
to clarify that Django 5.1+ native pooling (referenced as OPTIONS: {"pool":
{"min_size": 2, "max_size": 10}}) only works with PostgreSQL using psycopg3
(installable as psycopg[pool]) and does not support psycopg2, MySQL, SQLite, or
other backends; explicitly state the critical requirement to set CONN_MAX_AGE =
0 (Django raises ImproperlyConfigured if CONN_MAX_AGE > 0 or None) and note that
this pooling is not a universal fix for gevent + persistent connections across
all database drivers.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d9d954 and 70ada53.

⛔ Files ignored due to path filters (1)
  • images/gsoc/ideas/2026/celery-priority-resource-aware.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • developer/gsoc-ideas-2026.rst
  • spelling_wordlist.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • spelling_wordlist.txt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (7)
developer/gsoc-ideas-2026.rst (7)

1203-1228: LGTM!

The project metadata and introduction are well-structured and provide a clear overview of the project scope. The deliverables are clearly stated.


1229-1296: LGTM!

The problem statement effectively describes the current limitations and the project goals are clearly articulated with realistic expectations about mixed pool usage.


1364-1425: LGTM!

The pseudo-code examples effectively illustrate the proposed architecture. The three components (ResourceMonitor, ResourceAutoscaler, PriorityScheduler) demonstrate clear separation of concerns and the code is syntactically valid Python.


1497-1503: LGTM!

The sysctl configuration commands are now correct without the erroneous RST inline code markup. The bash code block is valid and ready for users to copy-paste.


1509-1616: LGTM!

The success criteria are measurable and realistic, with clear midterm checkpoints. The expected outcomes comprehensively cover all affected repositories and deliverables.


1636-1687: LGTM!

The prerequisites clearly define required knowledge, and the open questions provide contributors with meaningful research directions that demonstrate understanding of the problem space.


1472-1492: No issues identified. The code example correctly demonstrates using icmplib with gevent. The privileged=False parameter is supported and works as documented for non-privileged ICMP operations, the ping() function returns a Host object with the avg_rtt and packet_loss attributes as shown, and the gevent integration pattern (using blocking APIs within gevent.spawn() with early monkey-patching) is the standard, recommended approach for this use case.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines 1449 to 1456
- Django's persistent connections (``CONN_MAX_AGE > 0``) + ``gevent`` can
cause deadlocks.
- ``greenlets`` share the same thread, confusing Django's thread-local
connections.
- **Solution for Django 5.1+**: Use native connection pooling with
``OPTIONS: {"pool": {"min_size": 2, "max_size": 10}}``.
- **Solution for earlier Django**: Set ``CONN_MAX_AGE=0`` or use
``gevent`` aware connection pool.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Django 5.1 native database connection pooling OPTIONS configuration

💡 Result:

In Django 5.1, “native” connection pooling is supported only for PostgreSQL when using psycopg (psycopg3), via DATABASES["default"]["OPTIONS"]["pool"]. (docs.djangoproject.com)

Minimal config (use psycopg pool defaults)

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        # NAME/USER/PASSWORD/HOST/PORT...
        "CONN_MAX_AGE": 0,  # required with pooling
        "OPTIONS": {"pool": True},
    }
}

Django requires psycopg[pool] (or psycopg-pool) for this option, and it’s ignored if you’re using psycopg2. (docs.djangoproject.com)

Custom pool parameters (passed through to psycopg_pool.ConnectionPool)

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "CONN_MAX_AGE": 0,
        "OPTIONS": {
            "pool": {
                "min_size": 2,
                "max_size": 10,
                "timeout": 10,        # seconds to wait for a connection
                "max_lifetime": 3600, # recycle connections after N seconds
                "max_idle": 600,      # close extra idle connections after N seconds
            }
        },
    }
}

These keys are ConnectionPool options (e.g., max_lifetime, max_idle, timeout, etc.). (psycopg.org)

Important constraint: don’t use persistent connections with pooling

If OPTIONS["pool"] is enabled, Django will raise ImproperlyConfigured if you set CONN_MAX_AGE to a positive value or None (pooling replaces Django’s persistent-connection behavior), so keep CONN_MAX_AGE = 0. (docs.djangoproject.com)

Citations:


Clarify Django 5.1+ connection pooling limitations in the documentation.

The native connection pooling feature does exist in Django 5.1+ with the syntax OPTIONS: {"pool": {"min_size": 2, "max_size": 10}}, but the documentation is incomplete:

  • Works only with PostgreSQL using psycopg3 (requires psycopg[pool] package; does not work with psycopg2, MySQL, SQLite, or other databases)
  • Critical requirement: Must set CONN_MAX_AGE = 0 when using pooling; Django will raise ImproperlyConfigured if CONN_MAX_AGE > 0 or None
  • Not a universal solution for the gevent + persistent connections issue across all database backends

The documentation should explicitly state these constraints and the database/driver dependency to avoid misleading developers into attempting an incompatible solution.

🤖 Prompt for AI Agents
In `@developer/gsoc-ideas-2026.rst` around lines 1449 - 1456, Update the Django
gevent/persistent-connections section to clarify that Django 5.1+ native pooling
(referenced as OPTIONS: {"pool": {"min_size": 2, "max_size": 10}}) only works
with PostgreSQL using psycopg3 (installable as psycopg[pool]) and does not
support psycopg2, MySQL, SQLite, or other backends; explicitly state the
critical requirement to set CONN_MAX_AGE = 0 (Django raises ImproperlyConfigured
if CONN_MAX_AGE > 0 or None) and note that this pooling is not a universal fix
for gevent + persistent connections across all database drivers.

@nemesifier nemesifier force-pushed the gsoc26-monitoring-scalability branch from 70ada53 to fd31af6 Compare February 15, 2026 15:08
@nemesifier nemesifier merged commit fd31af6 into master Feb 15, 2026
3 checks passed
@nemesifier nemesifier deleted the gsoc26-monitoring-scalability branch February 15, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant