Skip to content

Commit

Permalink
doc: add include, refine others (#817)
Browse files Browse the repository at this point in the history
* doc: add include, refine others

Signed-off-by: Keming <[email protected]>

* update

Signed-off-by: Keming <[email protected]>

Signed-off-by: Keming <[email protected]>
  • Loading branch information
kemingy authored Aug 26, 2022
1 parent 630ada1 commit 82fbc87
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
34 changes: 32 additions & 2 deletions envd/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,20 @@ def shell(name: str):
"""Interactive shell
Args:
name (str): shell name(i.e. `zsh`)
name (str): shell name(i.e. `zsh`, `bash`)
"""


def run(commands: str):
"""Execute command
Args:
commands (str): command to run
commands (str): command to run during the building process
Example:
```
run(commands=["conda install -y -c conda-forge exa"])
```
"""


Expand All @@ -60,4 +65,29 @@ def git_config(
name (optional, str): User name
email (optional, str): User email
editor (optional, str): Editor for git operations
Example usage:
```
git_config(name="My Name", email="[email protected]", editor="vim")
```
"""


def include(git: str):
"""Import from another git repo
This will pull the git repo and execute all the `envd` files. The return value will be a module
contains all the variables/functions defined (expect those has `_` prefix).
Args:
git (str): git URL
Example usage:
```
envd = include("https://github.com/tensorchord/envdlib")
def build():
base(os="ubuntu20.04", language="python")
envd.tensorboard(8000)
```
"""
12 changes: 11 additions & 1 deletion envd/api/runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@


def command(commands: Dict[str, str]):
"""Execute commands
"""Execute commands during runtime
Args:
commands (Dict[str, str]): map name to command, similar to Makefile
Example usage:
```
runtime.command(commands={
"train": "python train.py --epoch 20 --notify [email protected]",
"run": "python server.py --batch 1 --host 0.0.0.0 --port 8000",
})
```
You can run `envd run --command train` to train the model.
"""


Expand Down

0 comments on commit 82fbc87

Please sign in to comment.