Method
string
required
The resource name of the tuning job to cancel. Format:
- Vertex AI:
projects/{project}/locations/{location}/tuningJobs/{job_id} - Gemini API:
tunedModels/{model_id}
CancelTuningJobConfig
Optional configuration for the cancel request
Response
HttpResponse
HTTP response information including headers and status
JOB_STATE_CANCELLED.
Usage
Cancel a Tuning Job
Cancel with Error Handling
Cancel All Running Jobs
Cancel and Wait for Confirmation
Conditional Cancellation
Important Notes
- Only jobs in
RUNNING,PENDING, orQUEUEDstates can be cancelled - Jobs that are
SUCCEEDED,FAILED, or alreadyCANCELLEDcannot be cancelled - Cancellation is asynchronous - the job state may not immediately reflect the cancellation
- No partial models are saved when a job is cancelled
- You will not be charged for the remaining compute time after cancellation
Error Handling
The cancel operation may fail in the following cases:- Job not found: The specified job name doesn’t exist
- Invalid state: The job is already completed or cancelled
- Permission denied: Insufficient permissions to cancel the job
- Network error: Connection issues with the API
See Also
- tunings.get - Check job status before cancelling
- tunings.list - Find jobs to cancel
- tunings.tune - Create a new tuning job