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

Executors: multi-queue: add heartbeat endpoint stub, db migrations, and UI changes#52381

Merged
sanderginn merged 49 commits into
sginn/executor-multi-dequeue-clientfrom
sginn/executor-multi-queue-heartbeat-endpoint
Jun 1, 2023
Merged

Executors: multi-queue: add heartbeat endpoint stub, db migrations, and UI changes#52381
sanderginn merged 49 commits into
sginn/executor-multi-dequeue-clientfrom
sginn/executor-multi-queue-heartbeat-endpoint

Conversation

@sanderginn

@sanderginn sanderginn commented May 24, 2023

Copy link
Copy Markdown
Contributor

Opening a draft PR to get some early reviews in. This is not fully complete yet, because the heartbeat depends on the client and Record interface to implement the necessary changes in order for heartbeats to be submitted successfully.

TODO

  • UI changes need some polishing
  • Update heartbeat signature to take the refactored string IDs after client implementation
  • More unit tests

Test plan

  • Local testing
  • Unit tests
  • Demo (parent PR)

@cla-bot cla-bot Bot added the cla-signed label May 24, 2023
@sanderginn sanderginn requested a review from a team May 24, 2023 17:57
Comment thread client/web/src/enterprise/executors/instances/ExecutorNode.tsx Outdated
Comment thread cmd/frontend/graphqlbackend/executor.go
Comment thread cmd/frontend/graphqlbackend/schema.graphql
Comment thread enterprise/cmd/executor/internal/apiclient/queue/client.go Outdated
@sourcegraph-buildkite

sourcegraph-buildkite commented May 24, 2023

Copy link
Copy Markdown
Collaborator

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.00% (+0.46 kb) 0.00% (+0.46 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 5d7af86 and 42be886 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

Comment thread internal/database/executors.go Outdated

@courier-new courier-new 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.

Frontend approved! 🫡

Comment thread cmd/frontend/graphqlbackend/schema.graphql
Comment thread client/web/src/enterprise/executors/instances/ExecutorNode.tsx Outdated

@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.

Overall, I think it looks great! Lots of changes you made to support this feature. Great job!

Comment thread cmd/frontend/graphqlbackend/executor.go
Comment thread cmd/frontend/graphqlbackend/executor.go
Comment thread cmd/frontend/graphqlbackend/executor.go
Comment thread cmd/frontend/graphqlbackend/schema.graphql
Comment thread client/web/src/enterprise/executors/instances/ExecutorNode.tsx Outdated
Comment thread go.mod
Comment thread internal/database/executors.go Outdated
@kalanchan

Copy link
Copy Markdown
Contributor

let's get a demo of this in demo days once it's complete :)

@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.

Nice job!

@sanderginn sanderginn force-pushed the sginn/executor-multi-queue-heartbeat-endpoint branch from 3f0aa46 to 6169716 Compare May 26, 2023 13:03
sanderginn and others added 17 commits May 26, 2023 15:23
- 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 sanderginn force-pushed the sginn/executor-multi-queue-heartbeat-endpoint branch from 6169716 to 7c5e5fd Compare May 26, 2023 13:37
sanderginn and others added 2 commits May 31, 2023 13:49
@sanderginn sanderginn marked this pull request as ready for review May 31, 2023 17:23
@sourcegraph-bot

sourcegraph-bot commented May 31, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 4bab424...5d7af86.

Notify File(s)
@BolajiOlajide client/web/src/enterprise/batches/batch-spec/batch-spec.mock.ts
client/web/src/enterprise/batches/batch-spec/execute/backend.ts
@courier-new client/web/src/enterprise/batches/batch-spec/batch-spec.mock.ts
client/web/src/enterprise/batches/batch-spec/execute/backend.ts
@efritz client/web/src/enterprise/executors/instances/ExecutorNode.tsx
client/web/src/enterprise/executors/instances/useExecutors.tsx
enterprise/cmd/executor/internal/apiclient/queue/client.go
enterprise/cmd/executor/internal/apiclient/queue/client_test.go
enterprise/cmd/frontend/internal/executorqueue/handler/BUILD.bazel
enterprise/cmd/frontend/internal/executorqueue/handler/multihandler.go
enterprise/cmd/frontend/internal/executorqueue/handler/multihandler_test.go
enterprise/cmd/frontend/internal/executorqueue/queuehandler.go
enterprise/internal/executor/types/http.go
enterprise/internal/executor/types/http_test.go
@eseliger client/web/src/enterprise/batches/batch-spec/batch-spec.mock.ts
client/web/src/enterprise/batches/batch-spec/execute/backend.ts
client/web/src/enterprise/executors/instances/ExecutorNode.tsx
client/web/src/enterprise/executors/instances/useExecutors.tsx
enterprise/cmd/frontend/internal/executorqueue/handler/BUILD.bazel
enterprise/cmd/frontend/internal/executorqueue/handler/multihandler.go
enterprise/cmd/frontend/internal/executorqueue/handler/multihandler_test.go
enterprise/cmd/frontend/internal/executorqueue/queuehandler.go
@sourcegraph/delivery doc/admin/executors/deploy_executors_terraform.md

@sanderginn

Copy link
Copy Markdown
Contributor Author

For the ones who got pinged when I changed this to a regular PR from draft, nothing has changed aside from merging in a child PR that was reviewed already, so no action needed

@sourcegraph-bot

sourcegraph-bot commented May 31, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@sanderginn

Copy link
Copy Markdown
Contributor Author

@sourcegraph/design
This PR slightly tweaks how executors are displayed in the site admin. It adds a badge for every queue name that is configured on the executor. There's currently no margin between each badge. Long executor names also cause multiline strings which doesn't look very good, but this is not introduced in this PR and has been in main for as long as I know.

Am I right to ping design on this? It doesn't require immediate attention but could be polished. Not sure if I should tag frontend instead.

Screenshot 2023-05-30 at 11 09 22

@sanderginn

Copy link
Copy Markdown
Contributor Author

FYI, I added a mr-1 class to all but the last badge. Good enough for now.

image

@sanderginn sanderginn merged commit e18cc37 into sginn/executor-multi-dequeue-client Jun 1, 2023
@sanderginn sanderginn deleted the sginn/executor-multi-queue-heartbeat-endpoint branch June 1, 2023 13:41
@Piszmog

Piszmog commented Jun 1, 2023

Copy link
Copy Markdown
Contributor

Looks good. I think I remember hearing that it is up to devs whether to pull in design or things.

I think since this is a minor change, what you did doesn't need review.

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.

7 participants