run
This command runs bx submit followed by bx attach.
Usage
bx run [--help] [-g=<gpus>] [-m=<memory>] [-t=<timeout>] [-v=<vcpus>] <image> <input>
Parameters, inputs and exit codes
- Parameters
- Inputs
- Exit codes
| Shorthand | Long version | Description |
|---|---|---|
-n | --nocache | Skip job execution caching |
-v | --vcpus=<vcpus> | Number of virtual CPUs |
-m | --memory=<memory> | RSS memory size (in MB) available for the container |
-g | --gpus=<gpus> | Number of GPUs |
-t | --timeout=<timeout> | Maximum allowed time (seconds) for the job |
--help | Show this help message and exit |
| Input | Description | Required |
|---|---|---|
<image> | Docker image | true |
<input> | Input message in JSON format | true |
Example
Run a hello-world job
$ bx run tutorial/hello-world:1.0.0 '{"yourName":"Michael Jordan"}'
[batchx] [INFO] [2020/03/09 17:37:16] Submitting job...
[batchx] [INFO] [2020/03/09 17:37:18] Job submitted with id 81
[batchx] [INFO] [2020/03/09 17:37:18] Attaching to job 81
[batchx] [INFO] [2020/03/09 17:37:19] Job status: SUBMITTED
[batchx] [INFO] [2020/03/09 17:41:18] Job status: STARTING
[batchx] [INFO] [2020/03/09 17:41:18] Job status: DOWNLOADING_INPUT
[batchx] [INFO] [2020/03/09 17:41:19] Job status: RUNNING
[tutorial/hello-world:1.0.0] [2020/03/09 17:41:22] Environment:
[tutorial/hello-world:1.0.0] [2020/03/09 17:41:22] environ({'HOSTNAME': 'batchx-container', 'PYTHON_PIP_VERSION': '20.0.2', 'HOME': '/root', 'GPG_KEY': 'E3FF2839C048B25C084DEBE9B26995E310250568', 'PYTHON_GET_PIP_URL': 'https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'BX_MEMORY': '1000', 'LANG': 'C.UTF-8', 'BX_GPUS': '0', 'PYTHON_VERSION': '3.8.1', 'BX_VCPUS': '1', 'PWD': '/batchx', 'PYTHON_GET_PIP_SHA256': '421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e'})
[batchx] [INFO] [2020/03/09 17:41:30] Job status: UPLOADING_OUTPUT
[batchx] [INFO] [2020/03/09 17:41:31] Job status: SUCCEEDED
{"responseFile":"bx://jobs/81/output/response/response.txt"}
tip
You can press ctrl-c at any point to detach from a running job without worrying on canceling or altering its state.