Skip to content

implement multi workspace - #22

Merged
xytan0056 merged 2 commits into
mainfrom
multiws
Feb 26, 2026
Merged

xytan0056 merged 2 commits into
mainfrom
multiws

Conversation

@xytan0056

@xytan0056 xytan0056 commented Feb 26, 2026 •

Copy link
Copy Markdown
Contributor

Currently repo manager only manages one workspace off of one clone. But we can manage multiple workspaces

Why?

Multi workspaces clones with "--local" , greatly speeds up the process and increase storage efficiency.

What?

  1. repo mananger manages configurable pool of workers per repo remote, each operates on a workspace; one leader for a remote + x workers
  2. reuses workers from previous runs via poolFor()
  3. if pool is at capacity, Lease blocks until a worker is returned or ctx is cancelled

Test Plan

CI unit test
local test

make run-server
run //example/client:client -- -addr 127.0.0.1:8081 -method get-changed-targets -remote https://github.com/uber/tango.git -base-sha 47f5e72cf858de87e60eddf58d48b36e70e97082~ -new-base-sha 59932143f27a3e6c230d444f13397f5167db3cef~3  > /tmp/test0.json

Issue

@xytan0056
xytan0056 marked this pull request as ready for review February 26, 2026 01:25
@xytan0056
xytan0056 requested review from a team as code owners February 26, 2026 01:25
)

const (
lockFileName = ".tango.lease.lock"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not needed anymore. We only need a mutex per repo, and workers concurrency is managed by avail chan


const (
lockFileName = ".tango.lease.lock"
lockTimeout = 5 * time.Minute

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

instead of timeout, we just wait until a workspace is available. If client doesn't wanna wait, it can just cancel the request

lockTimeout = 5 * time.Minute
lockRetryDelay = 15 * time.Second
)
const defaultPoolSize = 3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will do next diff, make it configurable


// Release releases the workspace lock.
// Release is a no-op for the base workspace; pooled workspaces override this.
func (w *workspace) Release() error {

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.

Looks like we don't need this function anymore?

@xytan0056 xytan0056 Feb 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good cactch!
It's actually still needed when orchestrator calls Release when bazel query and graphing is done. It's just overridden by pooledWorkspce

will do next diff

@xytan0056
xytan0056 merged commit e253002 into main Feb 26, 2026
1 check passed
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.

2 participants