-
Notifications
You must be signed in to change notification settings - Fork 3
feat(stovepipe): add queueconfig Store with default implementation #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) 2025 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package entity | ||
|
|
||
| // QueueConfig holds deployment configuration for a Stovepipe validation queue. | ||
| // Mutable runtime state (latest head, in-flight count) lives on the Queue row; | ||
| // knobs such as max_concurrent are resolved here at gate-check time. Immutable | ||
| // after load. | ||
| type QueueConfig struct { | ||
| // Name uniquely identifies this queue within the system. | ||
| // Referenced by Request.Queue. | ||
| Name string `json:"name" yaml:"name"` | ||
| // MaxConcurrent is the cap on concurrent in-flight validations for the queue. | ||
| MaxConcurrent int32 `json:"max_concurrent" yaml:"max_concurrent"` | ||
| // GateWaitDelayMs is the PublishAfter delay when the latest head waits for a slot. | ||
| GateWaitDelayMs int64 `json:"gate_wait_delay_ms" yaml:"gate_wait_delay_ms"` | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "go_default_library", | ||
| srcs = ["queueconfig.go"], | ||
| importpath = "github.com/uber/submitqueue/stovepipe/extension/queueconfig", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//stovepipe/entity:go_default_library"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Queue Config Extension | ||
|
|
||
| Vendor-agnostic interface for providing Stovepipe queue configurations. | ||
|
|
||
| Pipeline stages read mutable runtime state from storage and read knobs such as `max_concurrent` from a config `Store` at call time, matching the SubmitQueue split documented in [submitqueue/extension/queueconfig/README.md](../../../submitqueue/extension/queueconfig/README.md). | ||
|
|
||
| ## Interfaces | ||
|
|
||
| `Store` provides queue configurations by name via `Get` and `List`. See `queueconfig.go`. | ||
|
|
||
| ## Entities | ||
|
|
||
| Queue configuration entity lives in `stovepipe/entity/queue_config.go` and carries deployment knobs (`max_concurrent`, `gate_wait_delay_ms`) separate from the mutable `Queue` row. | ||
|
|
||
| ## Implementations | ||
|
|
||
| `default` returns the global wiring defaults for any non-empty queue name until a file- or service-backed store lands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| load("@rules_go//go:def.bzl", "go_library", "go_test") | ||
|
|
||
| go_library( | ||
| name = "go_default_library", | ||
| srcs = ["default.go"], | ||
| importpath = "github.com/uber/submitqueue/stovepipe/extension/queueconfig/default", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//stovepipe/entity:go_default_library", | ||
| "//stovepipe/extension/queueconfig:go_default_library", | ||
| ], | ||
| ) | ||
|
|
||
| go_test( | ||
| name = "go_default_test", | ||
| srcs = ["default_test.go"], | ||
| embed = [":go_default_library"], | ||
| deps = [ | ||
| "//stovepipe/extension/queueconfig:go_default_library", | ||
| "@com_github_stretchr_testify//assert:go_default_library", | ||
| "@com_github_stretchr_testify//require:go_default_library", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Copyright (c) 2025 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| // Package defaultconfig provides a queueconfig.Store that returns global wiring | ||
| // defaults for any non-empty queue name. Replace with a YAML- or service-backed | ||
| // store when per-queue overrides are needed. | ||
| package defaultconfig | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/uber/submitqueue/stovepipe/entity" | ||
| "github.com/uber/submitqueue/stovepipe/extension/queueconfig" | ||
| ) | ||
|
|
||
| const ( | ||
| _defaultMaxConcurrent = 1 | ||
| _defaultGateWaitDelayMs = 5000 | ||
| ) | ||
|
|
||
| // Store is a queueconfig.Store that returns the same defaults for every queue. | ||
| type Store struct{} | ||
|
|
||
| // NewStore returns a Store backed by global wiring defaults. | ||
| func NewStore() Store { | ||
| return Store{} | ||
| } | ||
|
|
||
| // Get returns the default configuration for any non-empty queue name. | ||
| func (Store) Get(_ context.Context, name string) (entity.QueueConfig, error) { | ||
| if name == "" { | ||
| return entity.QueueConfig{}, queueconfig.ErrNotFound | ||
| } | ||
| return entity.QueueConfig{ | ||
| Name: name, | ||
| MaxConcurrent: _defaultMaxConcurrent, | ||
| GateWaitDelayMs: _defaultGateWaitDelayMs, | ||
| }, nil | ||
| } | ||
|
|
||
| // List returns an empty slice; this store does not enumerate known queues. | ||
| func (Store) List(context.Context) ([]entity.QueueConfig, error) { | ||
| return nil, nil | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) 2025 Uber Technologies, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package defaultconfig | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "github.com/uber/submitqueue/stovepipe/extension/queueconfig" | ||
| ) | ||
|
|
||
| func TestStore_Get(t *testing.T) { | ||
| store := NewStore() | ||
|
|
||
| t.Run("returns defaults for named queue", func(t *testing.T) { | ||
| cfg, err := store.Get(context.Background(), "monorepo/main") | ||
| require.NoError(t, err) | ||
| assert.Equal(t, "monorepo/main", cfg.Name) | ||
| assert.Equal(t, int32(1), cfg.MaxConcurrent) | ||
| assert.Equal(t, int64(5000), cfg.GateWaitDelayMs) | ||
| }) | ||
|
|
||
| t.Run("empty name is not found", func(t *testing.T) { | ||
| _, err := store.Get(context.Background(), "") | ||
| require.ErrorIs(t, err, queueconfig.ErrNotFound) | ||
| }) | ||
| } | ||
|
|
||
| func TestStore_List(t *testing.T) { | ||
| store := NewStore() | ||
|
|
||
| cfg, err := store.List(context.Background()) | ||
| require.NoError(t, err) | ||
| assert.Empty(t, cfg) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "go_default_library", | ||
| srcs = ["queueconfig_mock.go"], | ||
| importpath = "github.com/uber/submitqueue/stovepipe/extension/queueconfig/mock", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//stovepipe/entity:go_default_library", | ||
| "@org_uber_go_mock//gomock:go_default_library", | ||
| ], | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.