Skip to main content
Cancel a training job that is currently running, queued, or paused. This action stops the training process immediately and releases allocated resources.

Path Parameters

string
required
Unique identifier of the training job to cancel

Request Body

string
Optional reason for cancelling the job (for logging and analysis)
boolean
default:"true"
Whether to keep existing checkpoints after cancellation
boolean
default:"false"
Whether to create a final checkpoint before cancelling (if job is running)
boolean
default:"false"
Force cancellation even if the job is in a transitional state

Response

string
ID of the cancelled training job
string
New job status after cancellation: cancelling or cancelled
object
Details about the cancellation process
object
Final training metrics at the time of cancellation
object
Final cost information

Example

Cancellation Process

The cancellation process follows these steps:
  1. Validation: Check if job can be cancelled (running, queued, or paused jobs only)
  2. Final Checkpoint: Create final checkpoint if requested and job is running
  3. Graceful Shutdown: Stop training process gracefully to preserve data integrity
  4. Resource Release: Release allocated GPUs, memory, and storage
  5. Status Update: Update job status to cancelled
  6. Cleanup: Remove temporary files (checkpoints are preserved if requested)

Job States and Cancellation

Force Cancellation

Use the force parameter for jobs that are stuck in transitional states:
Force cancellation may result in data loss and should only be used when normal cancellation fails.

Checkpoint Management

When cancelling a job, you have several checkpoint options:

Preserve Existing Checkpoints

Create Final Checkpoint

Clean Cancellation

Cost Implications

Cancelling a job has the following cost implications:
  • Incurred Costs: You pay for resources used up to the cancellation point
  • No Future Charges: No additional charges after successful cancellation
  • Checkpoint Storage: Preserved checkpoints continue to incur storage costs
  • Early Termination: No penalties for early cancellation

Common Use Cases

Early Stopping

Resource Reallocation

Hyperparameter Adjustment

Best Practices

  • Always provide a reason for cancellation to help with analysis and debugging
  • Create final checkpoints for running jobs to preserve training progress
  • Monitor the cancellation process as it may take a few minutes to complete
  • Clean up unused checkpoints periodically to manage storage costs
  • Use force cancellation sparingly and only when normal cancellation fails
Cancelled jobs remain in your job history for 30 days before being permanently removed. Checkpoints are preserved according to your retention settings.