Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Executors: add multi-queue configuration#52020

Merged
sanderginn merged 8 commits into
sginn/executor-multi-dequeue-clientfrom
sginn/executor-multi-queue-config
May 22, 2023
Merged

Executors: add multi-queue configuration#52020
sanderginn merged 8 commits into
sginn/executor-multi-dequeue-clientfrom
sginn/executor-multi-queue-config

Conversation

@sanderginn

@sanderginn sanderginn commented May 16, 2023

Copy link
Copy Markdown
Contributor

This PR:

  • Adds an env var EXECUTOR_QUEUE_NAMES to the config of an executor, which supports a comma-separated string of queue names to listen to
  • Validates that one and only one of EXECUTOR_QUEUE_NAME and EXECUTOR_QUEUE_NAMES is configured
  • Sets the value on the apiWorkerOptions and queueOptions

The actual client implementation is found in the parent PR.

TODO

Test plan

  • Unit tests
  • Demo (will be added to parent PR)

@sourcegraph-bot

sourcegraph-bot commented May 16, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff e7dbedc...01c3774.

Notify File(s)
@efritz enterprise/cmd/executor/internal/apiclient/queue/options.go
enterprise/cmd/executor/internal/config/config.go
enterprise/cmd/executor/internal/config/config_test.go
enterprise/cmd/executor/internal/worker/worker.go
@sourcegraph/delivery doc/admin/executors/deploy_executors_binary.md
doc/admin/executors/deploy_executors_terraform.md
doc/admin/executors/executors_troubleshooting.md

@sanderginn sanderginn requested a review from a team May 16, 2023 17:09

@Piszmog Piszmog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work! Some minor nits and an update to the docs.

Comment thread enterprise/cmd/executor/internal/config/config.go Outdated
Comment thread enterprise/cmd/executor/internal/config/config.go Outdated
Comment thread enterprise/cmd/executor/internal/config/config.go Outdated
Comment thread enterprise/cmd/executor/internal/run/util.go Outdated
Comment thread enterprise/cmd/executor/internal/run/util.go Outdated
@sanderginn

Copy link
Copy Markdown
Contributor Author

Created https://github.com/sourcegraph/sourcegraph/issues/52250 to support multiple queues for Terraform deployments

@sanderginn sanderginn merged commit 3afaebf into sginn/executor-multi-dequeue-client May 22, 2023
@sanderginn sanderginn deleted the sginn/executor-multi-queue-config branch May 22, 2023 12:26
@sanderginn

Copy link
Copy Markdown
Contributor Author

Build fails on some unrelated stuff, should be OK in the parent branch which merges into main

sanderginn added a commit that referenced this pull request May 26, 2023
- Closes https://github.com/sourcegraph/sourcegraph/issues/50616
- Coupled with https://github.com/sourcegraph/sourcegraph/pull/52016
(this is a child branch)

This PR:
- Adds an env var `EXECUTOR_QUEUE_NAMES` to the config of an executor,
which supports a comma-separated string of queue names to listen to
- Validates that one and only one of `EXECUTOR_QUEUE_NAME` and
`EXECUTOR_QUEUE_NAMES` is configured
- Sets the value on the `apiWorkerOptions` and `queueOptions`

The actual client implementation is found in the parent PR.

- [x] Update docs
- [ ] Update Terraform modules: see
https://github.com/sourcegraph/sourcegraph/issues/52250

- [x] Unit tests
- [ ] Demo (will be added to parent PR)
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
sanderginn referenced this pull request Jun 4, 2023
…2016)

- Closes https://github.com/sourcegraph/sourcegraph/issues/50614

Depends on the following issues:
- https://github.com/sourcegraph/sourcegraph/issues/50616
  - Merged in https://github.com/sourcegraph/sourcegraph/pull/52020
- https://github.com/sourcegraph/sourcegraph/issues/51656
  - Merged in https://github.com/sourcegraph/sourcegraph/pull/52381
- https://github.com/sourcegraph/sourcegraph/issues/51658
  - Merged in  https://github.com/sourcegraph/sourcegraph/pull/52525

Due to the dependency on the work listed above, all PRs were ultimately
merged into this branch, so the client side implementation got a little
bit messy to review, for which I apologize. The initial intent of this
PR, closing #50614, was reviewed before the merges occurred.

## Demos

### Scenario 1: old Sourcegraph version, new executor version
#### batches, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/6d325326-d4f5-4e6f-a5e0-0918dbde07bf

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/ff3a87db-ef07-4221-a159-73b93a6ae55b

### Scenario 2: new Sourcegraph version, old executor version
#### batches, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/c66a9b9f-b745-4abc-bf87-9077dd5f2959

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/785d7f34-630f-4c2a-abb6-82ca3b896813

### Scenario 3: new Sourcegraph version, new executor version
#### batches, single queue 

https://github.com/sourcegraph/sourcegraph/assets/2979513/69c5c06b-ea1c-47f7-9196-e3f108794493

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/4e791d98-06cd-4fa7-93dd-81be0a73c744

#### batches + codeintel in parallel, multi queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/004608dd-f98c-4305-aeb3-a01444c12224





## Initial PR description (enable client to dequeue from multiple
queues)
This PR updates the client's `Dequeue` method to dequeue from multiple
queues. It's backwards compatible with single-queue configurations. The
field `Job.Queue` is only set when dequeuing from the general `/dequeue`
endpoint, so the job `MarkXxx` methods default to single-queue behaviour
if the job does not specify a queue name.

Unrelated to the linked issue, the multi-handler will log and return no
content early in the event of an empty queue list in a dequeue request
(although this should never occur).

## Test plan
- [x] Unit tests
- [x] Local testing
- [x] Dogfood testing
- [x] Demo

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
ErikaRS referenced this pull request Jun 22, 2023
…2016)

- Closes https://github.com/sourcegraph/sourcegraph/issues/50614

Depends on the following issues:
- https://github.com/sourcegraph/sourcegraph/issues/50616
  - Merged in https://github.com/sourcegraph/sourcegraph/pull/52020
- https://github.com/sourcegraph/sourcegraph/issues/51656
  - Merged in https://github.com/sourcegraph/sourcegraph/pull/52381
- https://github.com/sourcegraph/sourcegraph/issues/51658
  - Merged in  https://github.com/sourcegraph/sourcegraph/pull/52525

Due to the dependency on the work listed above, all PRs were ultimately
merged into this branch, so the client side implementation got a little
bit messy to review, for which I apologize. The initial intent of this
PR, closing #50614, was reviewed before the merges occurred.

## Demos

### Scenario 1: old Sourcegraph version, new executor version
#### batches, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/6d325326-d4f5-4e6f-a5e0-0918dbde07bf

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/ff3a87db-ef07-4221-a159-73b93a6ae55b

### Scenario 2: new Sourcegraph version, old executor version
#### batches, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/c66a9b9f-b745-4abc-bf87-9077dd5f2959

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/785d7f34-630f-4c2a-abb6-82ca3b896813

### Scenario 3: new Sourcegraph version, new executor version
#### batches, single queue 

https://github.com/sourcegraph/sourcegraph/assets/2979513/69c5c06b-ea1c-47f7-9196-e3f108794493

#### codeintel, single queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/4e791d98-06cd-4fa7-93dd-81be0a73c744

#### batches + codeintel in parallel, multi queue

https://github.com/sourcegraph/sourcegraph/assets/2979513/004608dd-f98c-4305-aeb3-a01444c12224





## Initial PR description (enable client to dequeue from multiple
queues)
This PR updates the client's `Dequeue` method to dequeue from multiple
queues. It's backwards compatible with single-queue configurations. The
field `Job.Queue` is only set when dequeuing from the general `/dequeue`
endpoint, so the job `MarkXxx` methods default to single-queue behaviour
if the job does not specify a queue name.

Unrelated to the linked issue, the multi-handler will log and return no
content early in the event of an empty queue list in a dequeue request
(although this should never occur).

## Test plan
- [x] Unit tests
- [x] Local testing
- [x] Dogfood testing
- [x] Demo

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants