Skip to content

config: load queue settings for workers - #4366

Open
nocturney wants to merge 1 commit into
dagucloud:mainfrom
velvet-workspace:fix/worker-queue-config
Open

nocturney wants to merge 1 commit into
dagucloud:mainfrom
velvet-workspace:fix/worker-queue-config

Conversation

@nocturney

@nocturney nocturney commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Workers currently omit SectionQueues from their service-scoped configuration. As a result, a distributed run using dag.enqueue can fail with queues are disabled in configuration even when queues are enabled (including by default).

Changes

  • Load SectionQueues for ServiceWorker.
  • Update the service comment and add regression coverage for default, explicitly enabled, and explicitly disabled queues, including a named queue with max_concurrency: 2.

For example, with the following configuration, a worker previously saw Queues.Enabled == false and no named queue settings; after the fix it sees true and the configured queue limit of 2:

queues:
  enabled: true
  config:
    - name: batch
      max_concurrency: 2

Core change

internal/cmn/config/loader.go:154 adds the queue section to the worker's existing service requirements:

- ServiceWorker: SectionWorker | SectionCoordinator | SectionProc,
+ ServiceWorker: SectionWorker | SectionCoordinator | SectionProc | SectionQueues,

The existing queue loader then runs for workers, as it already does for other execution services. The dag.enqueue executor's existing enabled check can therefore use the actual worker configuration.

Testing

Tested on upstream main at 6a72fdbe41bea54e6fa076092c16ce4d236c2dd4, Go 1.27.4, darwin/arm64.

Independent reproduction: apply only the internal/cmn/config/loader_test.go portion of this PR, then run:

go test ./internal/cmn/config -run '^TestLoad_WorkerQueueConfig$' -count=1 -v
  • Before the fix: exit 1; all three subtests failed. Default and explicitly enabled queues were false, and named queue configuration was nil.
  • After applying the loader change: exit 0; all three subtests passed.
  • go test ./internal/cmn/config -count=1: PASS (2.318s).
  • go test -race ./internal/cmn/config -count=1: PASS (10.348s).
  • gofmt and git diff --check: clean for both changed files.

The regression tests the service-scoped loader directly; a full distributed end-to-end run was not performed. The package tests were run directly instead of through the make test wrapper, which also builds the entire binary. Repository-wide make fmt was not run.

Related Issues

Related changes: #1467 (service-scoped configuration) and #2163 (dag.enqueue). No matching open issue or duplicate PR was found in the targeted search.

Performance

No material performance risk: the worker loads the existing queue configuration at startup; no new polling, per-run work, messages, or persisted data are introduced.

Compatibility

No new configuration keys or wire-format changes. Existing queue settings, including explicitly disabled queues, retain their meaning. This change does not alter the coordinator/worker protocol or the persisted state format; mixed-version execution was not tested.

Checklist

  • Code follows the project style guidelines
  • Self-review of the code has been performed
  • Tests have been added or updated as needed
  • Documentation has been updated as needed (service comment)
  • Changes have been tested locally

Summary by cubic

Fixes worker queue configuration loading so dag.enqueue works in distributed runs.

Workers previously omitted SectionQueues from their service-scoped configuration, causing dag.enqueue to fail with "queues are disabled in configuration" even when queues were enabled (including by default). The loader now includes the queues section for workers, and regression tests cover default, explicitly enabled, and explicitly disabled queues, including a named queue with max_concurrency: 2.

Written for commit 7ac1a24. Summary will update on new commits.

View guided diff

Summary by CodeRabbit

  • Configuration
    • Worker configurations now load queue settings, including whether queues are enabled and their configured limits. Queues are enabled by default.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The worker configuration loader now requires the Queues section. Tests cover the default queue setting and YAML configurations with queues enabled or disabled.

Changes: Worker Queue Configuration

Layer / File(s) Summary
Worker queue configuration loading
internal/cmn/config/loader.go, internal/cmn/config/loader_test.go
The worker service now requires the Queues section. Tests verify that queue lookup returns the configured queue when enabled and does not return it when disabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to 7ac1a

Workers now load queue settings, so distributed runs that enqueue DAGs should no longer see queues as disabled. The change is small and covered by targeted regression tests, and no merge-blocking risk is apparent.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "config: load queue settings for workers" matches the main change: the loader now includes SectionQueues for ServiceWorker so worker configuration loads queue settings. It is short, specific…
Description check Passed The description follows the template well. It has Summary, Changes, Core change (with a short diff and file/line reference), Testing (before/after results), Related Issues, Performance, Compatibility,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "config: load queue settings for workers" matches the main change: the loader now includes SectionQueues for ServiceWorker so worker configuration loads queue settings. It is short, specific, and follows the conventional prefix style.

Full details: Description check

Explanation

The description follows the template well. It has Summary, Changes, Core change (with a short diff and file/line reference), Testing (before/after results), Related Issues, Performance, Compatibility, and a completed Checklist. It explains the problem, the user-visible effect with YAML, and the test evidence. The Security and Out of scope sections are optional and not needed. The Related Issues section does not use the 'Closes #' form, but it gives related issue numbers and states that no matching issue exists, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d07464f6-b844-4ac5-b066-9eae9f9d663f
Commits

Reviewing files that changed from the base of the PR and between 6a72fdb and 7ac1a24.

Files selected for processing: 2

  • internal/cmn/config/loader.go
  • internal/cmn/config/loader_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@yohamta0

Copy link
Copy Markdown
Member

Thanks for the PR. Not sure what workflow this is trying to unblock. Did you hit queues are disabled in configuration on a real worker? If so, what DAG and setup?

Also, getting past this check doesn't look like enough. The worker builds its sub-workflow runner without a queue store or DAG-run repository (remote_handler.go:835), so dag.enqueue would just fail next with dag.enqueue requires a DAG-run repository (local.go:333).

Mind opening an issue with the repro first? That way we can agree on where enqueue from a worker should be handled before changing the config.

@yohamta0 yohamta0 added review:waiting-on-maintainer Maintainer's turn: needs a maintainer review before merge and removed auto-review labels Dec 2, 2026

This branch has not been deployed

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

Labels

review:waiting-on-maintainer Maintainer's turn: needs a maintainer review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants