Skip to content

PART 2: fix: only report job limit in UI when globally reached - After #7232#7234

Draft
okurz wants to merge 3 commits intoos-autoinst:masterfrom
okurz:feature/057_poo198770_dynamic_global_job_limit_limited_by_server_config
Draft

PART 2: fix: only report job limit in UI when globally reached - After #7232#7234
okurz wants to merge 3 commits intoos-autoinst:masterfrom
okurz:feature/057_poo198770_dynamic_global_job_limit_limited_by_server_config

Conversation

@okurz
Copy link
Copy Markdown
Member

@okurz okurz commented Apr 1, 2026

Motivation:
The /tests page often displayed "(limited by server config)" even when far
below the actual limit. This happened because the backend was reporting the
limit based on filtered job counts rather than global counts, and was
unconditionally sending the static limit parameter when dynamic limits were
enabled.

Design Choices:

  • Updated list_running_ajax to calculate the global count of running jobs.
  • Only include dynamic_job_limit or max_running_jobs in the API response when
    the global count actually reaches or exceeds the respective limit.
  • Deduplicated configuration extraction in DynamicLimit.pm by mapping over
    the DEFAULTS hash.
  • Refactored t/ui/01-list.t to reduce repetition of the scheduler config path
    by using a shared $scheduler_config variable.
  • Improved test description strings in t/ui/01-list.t and
    t/26-dynamic-job-limit.t to be self-explanatory, eliminating the need for
    in-file comments.
  • Added comprehensive subtests to verify limit reporting behavior with
    filters and both dynamic/static configurations.

Benefits:

  • Eliminates misleading "limited by server config" messages.
  • Provides accurate server-wide limit status to users even in filtered views.
  • Cleaner and more maintainable test and implementation code.

Related issue: https://progress.opensuse.org/issues/198770

After:

@okurz okurz changed the title fix: only report job limit in UI when globally reached PART 3: fix: only report job limit in UI when globally reached - After #7231+#7232 Apr 1, 2026
@okurz okurz marked this pull request as draft April 1, 2026 10:46
okurz added 3 commits April 1, 2026 13:09
Motivation:
The dynamic limit tests contained significant repetition in setup and
execution logic, making them harder to maintain and read.
Consolidating them into a table-driven structure further reduces line
count and improves readability.

Design Choices:
- Introduced test_load_avg helper to encapsulate load parsing tests.
- Implemented a table-driven test structure for scaling logic, using
  an array of case hashes and a test_dynamic_limit helper.
- Used sensible defaults in helpers to minimize configuration noise in
  the test table.
- Sanitized temp file prefixes to handle test names with special
  characters safely.

Benefits:
- Significantly reduced line count (~100 lines vs ~157 originally).
- Improved maintainability through deduplication and a compact structure.
- Better focus on test data rather than boilerplate setup.

Related issue: os-autoinst#7202
Motivation:
The initial dynamic global job limit was too slow to scale up when the system
was idle, and its scaling factors were hardcoded and repeated across the
codebase, making maintenance difficult.

Design Choices:
- Implemented 'fast ramp-up' logic doubling the step size when load is low.
- Centralized all default scaling parameters as constants in DynamicLimit.pm.
- Updated OpenQA::Setup to use these constants for the configuration schema
  by referencing DynamicLimit->DEFAULTS.
- Refactored tests to rely on centralized constants and DEFAULTS, reducing
  repetition of literal values like '0.85' and '50'.
- Added current min/max values to "Dynamic job limit" log messages.

Benefits:
- Faster utilization of spare host capacity (reaching ceilings ~4x faster).
- Single source of truth for all dynamic limit defaults.
- Cleaner and more maintainable codebase and tests.
- Better operational visibility into the dynamic scaling behavior.

Related issue: https://progress.opensuse.org/issues/198770
Motivation:
The /tests page often displayed "(limited by server config)" even when far
below the actual limit. This happened because the backend was reporting the
limit based on filtered job counts rather than global counts, and was
unconditionally sending the static limit parameter when dynamic limits were
enabled.

Design Choices:
- Updated list_running_ajax to calculate the global count of running jobs.
- Only include dynamic_job_limit or max_running_jobs in the API response when
  the global count actually reaches or exceeds the respective limit.
- Deduplicated configuration extraction in DynamicLimit.pm by mapping over
  the DEFAULTS hash.
- Refactored t/ui/01-list.t to reduce repetition of the scheduler config path
  by using a shared $scheduler_config variable.
- Improved test description strings in t/ui/01-list.t and
  t/26-dynamic-job-limit.t to be self-explanatory, eliminating the need for
  in-file comments.
- Added comprehensive subtests to verify limit reporting behavior with
  filters and both dynamic/static configurations.

Benefits:
- Eliminates misleading "limited by server config" messages.
- Provides accurate server-wide limit status to users even in filtered views.
- Cleaner and more maintainable test and implementation code.

Related issue: https://progress.opensuse.org/issues/198770
@okurz okurz force-pushed the feature/057_poo198770_dynamic_global_job_limit_limited_by_server_config branch from 46184e1 to 57df01c Compare April 1, 2026 11:51
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 2, 2026

This pull request is now in conflicts. Could you fix it? 🙏

@okurz okurz changed the title PART 3: fix: only report job limit in UI when globally reached - After #7231+#7232 PART 2: fix: only report job limit in UI when globally reached - After #7232 Apr 2, 2026
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.

1 participant