Skip to content

Commit 1224025

Browse files
kiukchungfacebook-github-bot
authored andcommitted
Support Jetter (buck) workspace
Summary: ### Support Jetter (buck) Workspace Internal changes to support Jetter workspace, which builds workspace patches via Jetter at submit time. #### Key Changes: * Modified `mast.py` and `msl.py` to remove user-facing examples and notes. * Added `Fbsource` to `__init__.py` and updated `__all__` to include it. * Updated `hpc_scheduler.py` to include JetterWorkspace and create_jetter_scheduler. * Added a new example in `launch.py` demonstrating how to submit a BUCK-based job using JetterWorkspace. These changes lay the groundwork for supporting Jetter workspaces in TorchX, enabling more efficient and flexible job submissions. Differential Revision: D92295898
1 parent 79b6b26 commit 1224025

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

.claude/rules/coding-conventions.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,22 @@ raise ValueError(f"unknown scheduler: `{scheduler}`")
103103
## Tests
104104

105105
Location: `module/test/module_test.py` | Class: `ModuleTest` | Method: `test_*`
106+
107+
## Runopts (Scheduler Configuration)
108+
109+
**Avoid adding runopts to implement features.** This should be a last resort.
110+
111+
**Why:**
112+
1. Runopts reduce AppDef portability—the AppDef becomes tightly coupled to specific schedulers
113+
2. Runopts obscure scheduler behavior, making it hard for users to reason about the resulting job
114+
115+
**Preferred alternatives:**
116+
- **Overlays** in AppDef or Role metadata (search scheduler source for logic that applies user-specified overrides on top of the generated request)
117+
- **Workspace type checking**: `isinstance(self, SomeWorkspace)`
118+
- **Scheduler/workspace composition**: Compose schedulers and workspaces to encapsulate behavior
119+
- **Extend core APIs**: Add attributes/methods to `torchx.specs`, `torchx.schedulers`, `torchx.workspace`, or `torchx.runner`
120+
121+
**Anti-patterns (avoid these):**
122+
- **Resource capabilities**: `resource.capabilities["key"] = "value"` — overloads an unrelated field
123+
124+
Only add runopts when no alternative exists and the option is fundamental to scheduler operation.

torchx/runner/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ class Runner:
8888

8989
def __init__(
9090
self,
91-
name: str,
92-
scheduler_factories: dict[str, SchedulerFactory],
91+
name: str = "", # session names can be empty
92+
scheduler_factories: dict[str, SchedulerFactory] | None = None,
9393
component_defaults: dict[str, dict[str, str]] | None = None,
9494
scheduler_params: dict[str, object] | None = None,
9595
) -> None:
@@ -102,7 +102,9 @@ def __init__(
102102
schedulers: a list of schedulers the runner can use.
103103
"""
104104
self._name: str = name
105-
self._scheduler_factories = scheduler_factories
105+
self._scheduler_factories: dict[str, SchedulerFactory] = (
106+
scheduler_factories or {}
107+
)
106108
self._scheduler_params: dict[str, Any] = {
107109
**(self._get_scheduler_params_from_env()),
108110
**(scheduler_params or {}),

0 commit comments

Comments
 (0)