Skip to main content

cancel

This command cancels an active job given its job id.

Usage​

bx cancel [--help] <jobId>

Parameters and inputs​

ShorthandLong versionDescription
--helpShow this help message and exit

Examples​

Cancel a submitted job​

Submit a new job to BatchX using the hello-world image.

$ bx submit tutorial/hello-world:1.0.0 '{"yourName":"Michael Jordan"}'
[batchx] [INFO] [2020/03/17 20:02:13] Submitting job...
[batchx] [INFO] [2020/03/17 20:02:14] Job submitted with id 1141

If we are fast enough, we can see that its status is SUBMITTED by typing bx jobs:

$ bx jobs
ID IMAGE AGO USER BX-UNITS INPUT STATUS COST/H RUNTIME COST
1141 b@t/hello-world:1.0.0 2 s david 1x1000x0 SUBMITTED 0.34 USD 0.00 USD

If we now use the cancel command we will request its termination.

$ bx cancel 1141
[batchx] [INFO] [2020/03/17 20:02:26] Job cancellation submitted

If we then type bx jobs we will see that its status has changed to CANCELLING.

$ bx jobs
ID IMAGE AGO USER BX-UNITS INPUT STATUS COST/H RUNTIME COST
1141 b@t/hello-world:1.0.0 15 s david 1x1000x0 CANCELLING 0.34 USD 0.01 USD

Once the termination process completes this job will disappear from the list of active jobs but will remain registered in the historic job summary, along with its exit status. This can be displayed by typing bx jobs -a -l 1 to show our last submitted job.

$ bx jobs -a -l 1
ID IMAGE AGO USER BX-UNITS INPUT STATUS COST/H RUNTIME COST
1141 b@t/hello-world:1.0.0 3 m david 1x1000x0 CANCELLED 0.34 USD 30 s 0.01 USD