Skip to content

Commit ce97e5f

Browse files
committed
.
1 parent 3cf125c commit ce97e5f

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

commit0/__main__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from hydra.core.config_store import ConfigStore
1212
from commit0.configs.config_class import Commit0Config
1313
from commit0.harness.constants import COMMANDS, SPLIT
14+
from omegaconf import OmegaConf
1415

1516

1617
def main() -> None:
@@ -24,9 +25,15 @@ def main() -> None:
2425
cs.store(name="user", group="Commit0Config", node=Commit0Config)
2526
# have hydra to ignore all command-line arguments
2627
sys_argv = copy.deepcopy(sys.argv)
27-
sys.argv = [sys.argv[0]]
28+
cfg_arg = next((arg for arg in sys_argv if arg.startswith("--cfg=")), None)
2829
hydra.initialize(version_base=None, config_path="configs")
2930
config = hydra.compose(config_name="user")
31+
32+
if cfg_arg:
33+
config_name = cfg_arg.split("=")[1]
34+
user_config = OmegaConf.load(config_name)
35+
config = OmegaConf.merge(config, user_config)
36+
3037
# after hydra gets all configs, put command-line arguments back
3138
sys.argv = sys_argv
3239
# repo_split: split from command line has a higher priority than split in hydra

commit0/configs/base.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ repo_split: all
1313
num_workers: 8
1414

1515
# test related
16+
<<<<<<< HEAD
1617
backend: local
18+
=======
19+
backend: modal
20+
branch: ai
21+
>>>>>>> 22d3049 (update)
1722
timeout: 1_800
1823
num_cpus: 1
1924

docs/distributed.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Distributed
2+
3+
One of the main advantages of `commit0` is that it can run
4+
a range of unit tests in distributed environments.
5+
6+
By default, the library is configured to work with [modal](https://modal.com/).
7+
8+
```bash
9+
pip install modal
10+
modal token new
11+
```
12+
13+
## Modal Setup
14+
15+
To enable distributed run, first
16+
create a file called `distributed.yaml`
17+
18+
```yaml
19+
backend: modal
20+
base_dir: repos.dist/
21+
branch: master
22+
```
23+
24+
You can pass this configuration file as an argumnet to clone.
25+
26+
```bash
27+
commit0 clone lite --cfg=distributed.yaml
28+
```
29+
30+
Next run
31+
32+
```bash
33+
commit0 build lite --cfg=distributed.yaml
34+
```

docs/setup.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,3 @@ functions in one file of the minitorch library.
104104

105105
For a full example baseline system that tries to solve
106106
all the tests in the library see the [baseline](baseline) documentation.
107-
108-
109-
110-
## Distributed Environments
111-
112-
113-
...

0 commit comments

Comments
 (0)