submitServiceJob method
- required String jobName,
- required String jobQueue,
- required ServiceJobType serviceJobType,
- required String serviceRequestPayload,
- String? clientToken,
- ServiceJobPreemptionConfiguration? preemptionConfiguration,
- ServiceJobRetryStrategy? retryStrategy,
- int? schedulingPriority,
- Map<
String, String> ? tags, - ServiceJobTimeout? timeoutConfig,
Submits a service job to a specified job queue to run on SageMaker AI. A service job is a unit of work that you submit to Batch for execution on SageMaker AI.
May throw ClientException.
May throw ServerException.
Parameter jobName :
The name of the service job. It can be up to 128 characters long. It can
contain uppercase and lowercase letters, numbers, hyphens (-), and
underscores (_).
Parameter jobQueue :
The job queue into which the service job is submitted. You can specify
either the name or the ARN of the queue. The job queue must have the type
SAGEMAKER_TRAINING.
Parameter serviceJobType :
The type of service job. For SageMaker Training jobs, specify
SAGEMAKER_TRAINING.
Parameter serviceRequestPayload :
The request, in JSON, for the service that the SubmitServiceJob operation
is queueing.
Parameter clientToken :
A unique identifier for the request. This token is used to ensure
idempotency of requests. If this parameter is specified and two submit
requests with identical payloads and clientTokens are
received, these requests are considered the same request and the second
request is rejected.
Parameter preemptionConfiguration :
Specifies the service job behavior when preempted.
Parameter quotaShareName :
The quota share for the service job. Don't specify this parameter if the
job queue doesn't have a quota share scheduling policy. If the job queue
has a quota share scheduling policy, then this parameter must be
specified.
Parameter retryStrategy :
The retry strategy to use for failed service jobs that are submitted with
this service job request.
Parameter schedulingPriority :
The scheduling priority of the service job. Valid values are integers
between 0 and 9999.
Parameter shareIdentifier :
The share identifier for the service job. Don't specify this parameter if
the job queue doesn't have a fair-share scheduling policy. If the job
queue has a fair-share scheduling policy, then this parameter must be
specified.
Parameter tags :
The tags that you apply to the service job request. Each tag consists of a
key and an optional value. For more information, see Tagging
your Batch resources.
Parameter timeoutConfig :
The timeout configuration for the service job. If none is specified, Batch
defers to the default timeout of the underlying service handling the job.
Implementation
Future<SubmitServiceJobResponse> submitServiceJob({
required String jobName,
required String jobQueue,
required ServiceJobType serviceJobType,
required String serviceRequestPayload,
String? clientToken,
ServiceJobPreemptionConfiguration? preemptionConfiguration,
String? quotaShareName,
ServiceJobRetryStrategy? retryStrategy,
int? schedulingPriority,
String? shareIdentifier,
Map<String, String>? tags,
ServiceJobTimeout? timeoutConfig,
}) async {
final $payload = <String, dynamic>{
'jobName': jobName,
'jobQueue': jobQueue,
'serviceJobType': serviceJobType.value,
'serviceRequestPayload': serviceRequestPayload,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (preemptionConfiguration != null)
'preemptionConfiguration': preemptionConfiguration,
if (quotaShareName != null) 'quotaShareName': quotaShareName,
if (retryStrategy != null) 'retryStrategy': retryStrategy,
if (schedulingPriority != null) 'schedulingPriority': schedulingPriority,
if (shareIdentifier != null) 'shareIdentifier': shareIdentifier,
if (tags != null) 'tags': tags,
if (timeoutConfig != null) 'timeoutConfig': timeoutConfig,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/submitservicejob',
exceptionFnMap: _exceptionFns,
);
return SubmitServiceJobResponse.fromJson(response);
}