Skip to main content

run-local

This command runs in your local machine a BatchX image that is stored in your local Docker cache. run-local will mimic the validation and container parametrization performed by BatchX when processing a job submission.

Therefore, is a reliable mechanism to test Docker images before uploading them to BatchX.

Outputs generated from local executions will be stored under the /home/<user_name>/.bx/fs/jobs/ path.

info

This command allows specifying a port to connect to the container. This might be very useful for connecting to a remote debugger within your container.

caution

With the run-local command you can't reference resources stored in BatchX. Running a local job implies that both, the image as well as its input files (if any) are stored locally.

Usage

bx run-local [--help] [-m=<memory>] [-p=<portMapping>] [-v=<vcpus>] <image> <input>

Parameters, inputs and exit codes

ShorthandLong versionDescription
-v--vcpus=<vcpus>Number of virtual CPUs
-m--memory=<memory>RSS memory size (in MB) available for the container
-p--port=<portMapping>Debugging port mapping (host:container)
--helpShow this help message and exit

Examples

Run locally hello-world

caution

To follow this example you will need to have the hello-world image stored in your local computer or server. To build this image Hello world image read the section.

$ bx run-local tutorial/hello-world:1.0.0 '{"yourName":"Michael Jordan"}'
[batchx] [INFO] [2020/03/17 20:38:41] Running job locally...
[batchx] [INFO] [2020/03/17 20:38:42] Storing job information at /home/mj/.bx/fs/jobs/1584473922001
[tutorial/hello-world:1.0.0] Environment:
[tutorial/hello-world:1.0.0] environ({'HOSTNAME': 'c44763234d43', 'PYTHON_PIP_VERSION': '19.1.1', 'SHLVL': '1', 'HOME': '/root', 'GPG_KEY': '0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'BX_MEMORY': '1000', 'LANG': 'C.UTF-8', 'PYTHON_VERSION': '3.6.8', 'BX_VCPUS': '1', 'PWD': '/batchx'})
[batchx] [INFO] [2020/03/17 20:38:42] Container exit code 0
{"responseFile":"/home/mj/.bx/fs/jobs/1584473922001/output/response/response.txt"}