runtime
Runtime functions
TIP
Note that the documentation is automatically generated from envd/api folder in tensorchord/envd repo. Please update the python file there instead of directly editing file inside envd-docs repo.
WARNING
v0 syntax is no longer supported from envd>=v1.0. Check the upgrade guide.
If you want to use v0 syntax, try pip install 'envd<1'.
command
def command(commands: Dict[str, str])Execute commands during runtime
Arguments:
commandsDict[str, str] - map name to command, similar to MakefileExample usage:
runtime.command(commands={
"train": "python train.py --epoch 20 --notify me@tensorchord.ai",
"run": "python server.py --batch 1 --host 0.0.0.0 --port 8000",
})You can run envd exec --command train to train the model.
expose
def expose(envd_port: int, host_port: Optional[int], service: Optional[str],
listen_addr: Optional[str])Expose port to host Proposal: https://github.com/tensorchord/envd/pull/780
Arguments:
envd_portint - port inenvdcontainerhost_portOptional[int] - port in the host, if not provided orhost_port=0,envdwill randomly choose a free portserviceOptional[str] - service namelisten_addrOptional[str] - address to listen on
daemon
def daemon(commands: List[List[str]])Run daemon processes in the container Proposal: https://github.com/tensorchord/envd/pull/769
It's better to redirect the logs to local files for debugging purposes.
You can find the generated horust config files under /etc/horust/services and log files under /var/log/horust in the container.
Arguments:
commandsList[List[str]] - run multiple commands in the backgroundExample usage:
runtime.daemon(commands=[
["jupyter-lab", "--port", "8080"],
["python3", "serving.py", ">>serving.log", "2>&1"],
])environ
def environ(env: Dict[str, str], extra_path: List[str])Add runtime environments
Arguments:
envDict[str, str] - environment name to valueextra_pathList[str] - additional PATHExample usage:
runtime.environ(env={"ENVD_MODE": "DEV"}, extra_path=["/usr/bin/go/bin"])mount
def mount(host_path: str, envd_path: str)Mount from host path to container path (runtime)
Arguments:
host_pathstr - source path in the host machineenvd_pathstr - destination path in the envd container
init
def init(commands: List[str])Commands to be executed when start the container
You can find the generated horust config files under /etc/horust/services and log files under /var/log/horust in the container.
Arguments:
commandsList[str] - list of commands