Skip to main content

BatchX CLI

The BatchX CLI exposes all functionality offered by BatchX to the command line.

CLI components

In a user machine, the BatchX CLI is comprised of two separate components:

  1. The server: batchx-daemon, a cross-platform java jarbinary that runs as a long-running process (a service) that handles the requests sent by the bx clients (running in the same machine).
  2. The client: bx, a lightweight native application that communicates to the previous daemon.

The main reasons for having these two separate components are reducing the command latency experienced by the user and allowing automatic updates in the background.

$ bx
Run batch workloads in the BatchX cloud
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
whoami Show information about the logged user
env Switch or show environment information
add-token Add a connection token for a third-party server
import Import a Docker image into BatchX
images List imported images
image Show image information
rmi Delete an image
submit Schedule a job to run in BatchX
attach Attach local stderr and stdout to a running job
run Submit and attach at once
resubmit Retry a past job
rerun Resubmit and attach
cancel Cancel a running job
rmj Delete a job
logs Retrieve job logs
run-local Run a Docker image locally
jobs List jobs
job Show job details
ls List information about the files in your BatchX file-system
cat Stream the contents of a BatchX file to stdout
rm Remove a file or folder from your BatchX file-system
cp Copy files to/from your BatchX file-system
tree Show the file-system structure under a specified folder

Environment variables

The CLI is configured through the following environment variables (of the bx client process):

  • BATCHX_ENDPOINT: BatchX API server, the daemon will communicate with, in the form of <hostname>:<port>.
  • BATCHX_TOKEN: BatchX JSON Web Token used for authenticating the user, and authorizing their actions.
  • BATCHX_ENV: The name of the default environment to use. If empty, the user environment will apply.

The installation scripts automate the configuration and persistence of these variables.

Automatic updates

The CLI is automatically updated whenever a new version is available.