cancelTuningJob method

  1. @override
Future<void> cancelTuningJob(
  1. CancelTuningJobRequest request
)
override

Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use GenAiTuningService.GetTuningJob or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the TuningJob is not deleted; instead it becomes a job with a TuningJob.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED, and TuningJob.state is set to CANCELLED.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Future<void> cancelTuningJob(CancelTuningJobRequest request) async {
  if (isClosed) throw StateError('Service is closed');

  if (_cancelTuningJob case final cancelTuningJob?) {
    return cancelTuningJob(request);
  }
  throw UnsupportedError('cancelTuningJob');
}