You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/guides/execution.md
+42-3Lines changed: 42 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ After configuring NeMo-Run, the next step is to execute it. Nemo-Run decouples c
4
4
5
5
Each execution of a single configured task requires an executor. Nemo-Run provides `run.Executor`, which are APIs to configure your remote executor and set up the packaging of your code. Currently we support:
6
6
-`run.LocalExecutor`
7
+
-`run.DockerExecutor`
7
8
-`run.SlurmExecutor` with an optional `SSHTunnel` for executing on Slurm clusters from your local machine
8
9
-`run.SkypilotExecutor` (available under the optional feature `skypilot` in the python package).
9
10
@@ -36,10 +37,13 @@ The packager support matrix is described below:
`run.Packager` is a passthrough base packager. `run.GitArchivePackager` uses `git archive` to package your code. Refer to the API reference for `run.GitArchivePackager` to see the exact mechanics of packaging using `git archive`.
44
+
`run.Packager` is a passthrough base packager.
45
+
46
+
`run.GitArchivePackager` uses `git archive` to package your code. Refer to the API reference for `run.GitArchivePackager` to see the exact mechanics of packaging using `git archive`.
43
47
At a high level, it works in the following way:
44
48
1. base_path = `git rev-parse --show-toplevel`.
45
49
2. Optionally define a subpath as `base_path/GitArchivePackager.subpath` by setting `subpath` attribute on `GitArchivePackager`.
@@ -60,6 +64,20 @@ If you're executing a Python function, this working directory will automatically
60
64
61
65
> **_NOTE:_** git archive doesn't package uncommitted changes. In the future, we may add support for including uncommitted changes while honoring `.gitignore`.
62
66
67
+
`run.PatternPackager` is a packager that uses a pattern to package your code. It is useful for packaging code that is not under version control. For example, if you have a directory structure like this:
68
+
```
69
+
- docs
70
+
- src
71
+
- your_library
72
+
```
73
+
74
+
You can use `run.PatternPackager` to package your code by specifying `include_pattern` as `src/**` and `relative_path` as `os.getcwd()`. This will package the entire `src` directory. The command used to get the list of files to package is:
cd {relative_path} && find {relative_include_pattern} -type f
79
+
```
80
+
63
81
### Defining Executors
64
82
Next, We'll describe details on setting up each of the executors below.
65
83
@@ -69,6 +87,27 @@ The LocalExecutor is the simplest executor. It executes your task locally in a s
69
87
70
88
The easiest way to define one is to call `run.LocalExecutor()`.
71
89
90
+
#### DockerExecutor
91
+
92
+
The DockerExecutor enables launching a task using `docker` on your local machine. It requires `docker` to be installed and running as a prerequisite.
93
+
94
+
The DockerExecutor uses the [docker python client](https://docker-py.readthedocs.io/en/stable/) and most of the options are passed directly to the client.
95
+
96
+
Below is an example of configuring a Docker Executor
97
+
98
+
```python
99
+
run.DockerExecutor(
100
+
container_image="python:3.12",
101
+
num_gpus=-1,
102
+
runtime="nvidia",
103
+
ipc_mode="host",
104
+
shm_size="30g",
105
+
volumes=["/local/path:/path/in/container"],
106
+
env_vars={"PYTHONUNBUFFERED": "1"},
107
+
packager=run.Packager(),
108
+
)
109
+
```
110
+
72
111
#### SlurmExecutor
73
112
74
113
The SlurmExecutor enables launching the configured task on a Slurm Cluster with Pyxis. Additionally, you can configure a `run.SSHTunnel`, which enables you to execute tasks on the Slurm cluster from your local machine while NeMo-Run manages the SSH connection for you. This setup supports use cases such as launching the same task on multiple Slurm clusters.
0 commit comments