-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(ci): xdist per-worker isolation infrastructure #110775
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
452a096
feat(ci): xdist per-worker isolation infrastructure
mchen-sentry 290270e
fix(tests): remove leftover end_timestamp kwarg from Span constructor
mchen-sentry 62bd4a5
fix(tests): guard against exceeding Redis DB limit with too many xdis…
mchen-sentry 9e9c822
Merge branch 'master' into mingchen/di-1712-xdist-infra
mchen-sentry 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import os | ||
|
|
||
| _TEST_REDIS_DB = 9 | ||
| _SNUBA_BASE_PORT = 1230 | ||
| # Redis defaults to 16 DBs (0-15). With base DB 9, max 7 workers (gw0-gw6). | ||
| _MAX_WORKERS = 7 | ||
|
|
||
| _worker_id: str | None = os.environ.get("PYTEST_XDIST_WORKER") | ||
| _worker_num: int | None = int(_worker_id.replace("gw", "")) if _worker_id else None | ||
|
|
||
| if _worker_num is not None and _worker_num >= _MAX_WORKERS: | ||
| raise RuntimeError( | ||
| f"xdist worker {_worker_id} exceeds max supported workers ({_MAX_WORKERS}). " | ||
| f"Redis only has DBs 0-15 and base DB is {_TEST_REDIS_DB}." | ||
| ) | ||
|
|
||
|
|
||
| def get_redis_db() -> int: | ||
| if _worker_num is not None: | ||
| return _TEST_REDIS_DB + _worker_num | ||
| return _TEST_REDIS_DB | ||
|
|
||
mchen-sentry marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| def get_kafka_topic(base_name: str) -> str: | ||
| if _worker_id: | ||
| return f"{base_name}-{_worker_id}" | ||
| return base_name | ||
|
|
||
|
|
||
| def get_snuba_url() -> str | None: | ||
| if _worker_num is not None and os.environ.get("XDIST_PER_WORKER_SNUBA"): | ||
| return f"http://127.0.0.1:{_SNUBA_BASE_PORT + _worker_num}" | ||
| return None | ||
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
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.