Skip to content

Commit 09cfdb0

Browse files
authored
feat(miner): Add remote capability to DockerExecutorManager (COM-542) (#668)
The `DockerExecutorManager` has been expanded to support multiple remote executors as well as running one executor locally. You can configure the executors with a config file. The local executor is run directly on the host machine using docker. The remote executors are run on a remote machine using docker over ssh. The default config uses one local executor.
1 parent 1e34b0c commit 09cfdb0

File tree

9 files changed

+735
-108
lines changed

9 files changed

+735
-108
lines changed

miner/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,56 @@ Most straightforward option is to use a "miner-runner" docker image which will l
1616

1717
Alternatively, you can use `docker-compose` to launch all the necessary services manually. See [docker-compose.yml](envs/runner/data/docker-compose.yml) for reference.
1818

19+
## Using the docker executor manager
20+
21+
The default config of the docker executor manager runs executors in docker containers on the same machine as the miner (for `DEFAULT_EXECUTOR_CLASS`).
22+
It can be configured to run executors in docker containers on remote machines for different executor classes.
23+
To do this, follow these steps:
24+
25+
1. Create a directory for your configuration, e.g., `/home/ubuntu/vendor`.
26+
2. Generate an SSH key pair in this directory for the executor manager to use to connect to the executors.
27+
If your executor machines require different keys, you can put all the keys here.
28+
The executor machines must accept SSH connections from the miner machine with the key configured below.
29+
3. Create a YAML file in the directory (i.e., `docker_config.yaml`) and configure your executor machines. For example:
30+
```yaml
31+
executor-1:
32+
executor_class: always_on.llm.a6000
33+
mode: ssh
34+
host: "1.2.3.4"
35+
ssh_port: 22
36+
username: "ubuntu"
37+
key_path: "/root/vendor/id_ed25519_miner"
38+
39+
executor-2:
40+
executor_class: always_on.llm.a6000
41+
mode: ssh
42+
host: "1.1.1.1"
43+
ssh_port: 22
44+
username: "ubuntu"
45+
key_path: "/root/vendor/id_ed25519_miner"
46+
```
47+
The root keys are names of the executor machines, which can be anything you want.
48+
You can set the value of `executor_class` to a special value `DEFAULT_EXECUTOR_CLASS` to use the default executor manager set in your `.env`.
49+
Along with other remote servers, you can also configure one executor to run locally on the miner machine:
50+
```yaml
51+
executor-local:
52+
executor_class: always_on.llm.a6000
53+
mode: local
54+
```
55+
> [!NOTE]
56+
> If you use ddos-shield, your local executor cannot serve streaming jobs.
57+
4. Update your `.env` file with the following variables:
58+
```
59+
HOST_VENDOR_DIR=/home/ubuntu/vendor
60+
DOCKER_EXECUTORS_CONFIG_PATH=/root/vendor/docker_config.yaml
61+
```
62+
5. (Optional) You can add `DEBUG_AUTO_REMOVE_EXECUTOR_CONTAINERS=False` in `.env` to skip removing containers automatically after they are stopped (i.e., for debugging purposes).
63+
6. Restart your miner.
64+
65+
> [!NOTE]
66+
> `HOST_VENDOR_DIR` will be mounted to `/root/vendor` inside the miner container.
67+
> So, `key_path` in the YAML config and `DOCKER_EXECUTORS_CONFIG_PATH` in `.env` should be relative to `/root/vendor`.
68+
1969
## Custom executor manager
2070

2171
Miners are encouraged to optimize their setup by implementing their own executor manager. To use your custom code, follow these steps:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
self:
2+
executor_class: DEFAULT_EXECUTOR_CLASS
3+
mode: local

0 commit comments

Comments
 (0)