Cancel Job#

Prerequisites#

Before you can cancel a customization job, make sure that you have:

  • Obtained the base URL of your NeMo Customizer service.

  • Set the CUSTOMIZER_BASE_URL environment variable to your NeMo Customizer service endpoint

export CUSTOMIZER_BASE_URL="https://your-customizer-service-url"

To Cancel a Customization Job#

Running jobs may be cancelled. A cancelled job does not upload checkpoints.

Choose one of the following options to cancel a customization job.

import os
from nemo_microservices import NeMoMicroservices

# Initialize the client
client = NeMoMicroservices(
    base_url=os.environ['CUSTOMIZER_BASE_URL']
)

# Cancel a customization job
job_id = "cust-2i89UCiDd3Q7D2JHRcmwXx"
cancelled_job = client.customization.jobs.cancel(job_id)

print(f"Job {cancelled_job.id} has been cancelled")
print(f"Current status: {cancelled_job.status}")
print(f"Updated at: {cancelled_job.updated_at}")
curl -X POST \
  "${CUSTOMIZER_BASE_URL}/customization/jobs/{job_id}/cancel" \
  -H 'Accept: application/json'
Example Response
{
  "id": "cust-2i89UCiDd3Q7D2JHRcmwXx",
  "created_at": "2025-03-20T22:07:06.355526",
  "updated_at": "2025-03-20T22:07:35.148163",
  "project": "test-project",
  "ownership": {
    "created_by": "me",
    "access_policies": {
      "arbitrary": "json"
    }
  },
  "dataset": "default/test-small-dataset",
  "output_model": "default/test_cancel_llama_3_2@v1",
  "config": {
    "base_model": "meta/llama-3.1-8b-instruct",
    "precision": "bf16-mixed",
    "num_gpus": 1,
    "num_nodes": 1,
    "micro_batch_size": 1,
    "tensor_parallel_size": 1,
    "max_seq_length": 4096,
    "prompt_template": "{prompt} {completion}"
  },
  "hyperparameters": {
    "finetuning_type": "lora",
    "training_type": "sft",
    "batch_size": 16,
    "epochs": 1,
    "learning_rate": 0.0001,
    "lora": {
      "adapter_dim": 32,
      "alpha": 16,
      "adapter_dropout": null
    },
    "sequence_packing_enabled": false
  },
  "status": "cancelled"
}