2026/03/19 - AWS Batch - 6 new 7 updated api methods
Changes AWS Batch now supports quota management, enabling administrators to allocate shared compute resources across teams and projects through quota shares with capacity limits, resource-sharing strategies, and priority-based preemption - currently available for SageMaker Training job queues.
Updates the priority of a specified service job in an Batch job queue.
See also: AWS API Documentation
Request Syntax
client.update_service_job(
jobId='string',
schedulingPriority=123
)
string
[REQUIRED]
The Batch job ID of the job to update.
integer
[REQUIRED]
The scheduling priority for the job. This only affects jobs in job queues with a quota-share or fair-share scheduling policy. Jobs with a higher scheduling priority are scheduled before jobs with a lower scheduling priority within a share.
The minimum supported value is 0 and the maximum supported value is 9999.
dict
Response Syntax
{
'jobArn': 'string',
'jobName': 'string',
'jobId': 'string'
}
Response Structure
(dict) --
jobArn (string) --
The Amazon Resource Name (ARN) for the job.
jobName (string) --
The name of the job.
jobId (string) --
The unique identifier for the job.
{'quotaSharePolicy': {'idleResourceAssignmentStrategy': 'FIFO'}}
Creates an Batch scheduling policy.
See also: AWS API Documentation
Request Syntax
client.create_scheduling_policy(
name='string',
quotaSharePolicy={
'idleResourceAssignmentStrategy': 'FIFO'
},
fairsharePolicy={
'shareDecaySeconds': 123,
'computeReservation': 123,
'shareDistribution': [
{
'shareIdentifier': 'string',
'weightFactor': ...
},
]
},
tags={
'string': 'string'
}
)
string
[REQUIRED]
The name of the fair-share scheduling policy. It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_).
dict
The quota share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a fairSharePolicy.
idleResourceAssignmentStrategy (string) -- [REQUIRED]
The strategy that determines how idle resources are assigned to quota shares that are borrowing capacity. Currently, only FIFO is supported.
dict
The fair-share scheduling policy details. Only one of fairsharePolicy or quotaSharePolicy can be set. Once set, this policy type cannot be removed or changed to a quotaSharePolicy.
shareDecaySeconds (integer) --
The amount of time (in seconds) to use to calculate a fair-share percentage for each share identifier in use. A value of zero (0) indicates the default minimum time window (600 seconds). The maximum supported value is 604800 (1 week).
The decay allows for more recently run jobs to have more weight than jobs that ran earlier. Consider adjusting this number if you have jobs that (on average) run longer than ten minutes, or a large difference in job count or job run times between share identifiers, and the allocation of resources doesn't meet your needs.
computeReservation (integer) --
A value used to reserve some of the available maximum vCPU for share identifiers that aren't already used.
The reserved ratio is (computeReservation/100)^ActiveFairShares where ActiveFairShares is the number of active share identifiers.
For example, a computeReservation value of 50 indicates that Batch reserves 50% of the maximum available vCPU if there's only one share identifier. It reserves 25% if there are two share identifiers. It reserves 12.5% if there are three share identifiers. A computeReservation value of 25 indicates that Batch should reserve 25% of the maximum available vCPU if there's only one share identifier, 6.25% if there are two fair share identifiers, and 1.56% if there are three share identifiers.
The minimum value is 0 and the maximum value is 99.
shareDistribution (list) --
An array of SharedIdentifier objects that contain the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
(dict) --
Specifies the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
shareIdentifier (string) -- [REQUIRED]
A share identifier or share identifier prefix. If the string ends with an asterisk (*), this entry specifies the weight factor to use for share identifiers that start with that prefix. The list of share identifiers in a fair-share policy can't overlap. For example, you can't have one that specifies a shareIdentifier of UserA* and another that specifies a shareIdentifier of UserA1.
There can be no more than 500 share identifiers active in a job queue.
The string is limited to 255 alphanumeric characters, and can be followed by an asterisk (*).
weightFactor (float) --
The weight factor for the share identifier. The default value is 1.0. A lower value has a higher priority for compute resources. For example, jobs that use a share identifier with a weight factor of 0.125 (1/8) get 8 times the compute resources of jobs that use a share identifier with a weight factor of 1.
The smallest supported value is 0.0001, and the largest supported value is 999.9999.
dict
The tags that you apply to the scheduling policy to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging Amazon Web Services Resources in Amazon Web Services General Reference.
These tags can be updated or removed using the TagResource and UntagResource API operations.
(string) --
(string) --
dict
Response Syntax
{
'name': 'string',
'arn': 'string'
}
Response Structure
(dict) --
name (string) --
The name of the scheduling policy.
arn (string) --
The Amazon Resource Name (ARN) of the scheduling policy. The format is aws:Partition:batch:Region:Account:scheduling-policy/Name ``. For example, ``aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.
{'schedulingPolicies': {'quotaSharePolicy': {'idleResourceAssignmentStrategy': 'FIFO'}}}
Describes one or more of your scheduling policies.
See also: AWS API Documentation
Request Syntax
client.describe_scheduling_policies(
arns=[
'string',
]
)
list
[REQUIRED]
A list of up to 100 scheduling policy Amazon Resource Name (ARN) entries.
(string) --
dict
Response Syntax
{
'schedulingPolicies': [
{
'name': 'string',
'arn': 'string',
'quotaSharePolicy': {
'idleResourceAssignmentStrategy': 'FIFO'
},
'fairsharePolicy': {
'shareDecaySeconds': 123,
'computeReservation': 123,
'shareDistribution': [
{
'shareIdentifier': 'string',
'weightFactor': ...
},
]
},
'tags': {
'string': 'string'
}
},
]
}
Response Structure
(dict) --
schedulingPolicies (list) --
The list of scheduling policies.
(dict) --
An object that represents a scheduling policy.
name (string) --
The name of the fair-share scheduling policy.
arn (string) --
The Amazon Resource Name (ARN) of the scheduling policy. An example is ``arn:aws:batch:us-east-1:123456789012:scheduling-policy/HighPriority ``.
quotaSharePolicy (dict) --
The quota share scheduling policy details.
idleResourceAssignmentStrategy (string) --
The strategy that determines how idle resources are assigned to quota shares that are borrowing capacity. Currently, only FIFO is supported.
fairsharePolicy (dict) --
The fair-share scheduling policy details.
shareDecaySeconds (integer) --
The amount of time (in seconds) to use to calculate a fair-share percentage for each share identifier in use. A value of zero (0) indicates the default minimum time window (600 seconds). The maximum supported value is 604800 (1 week).
The decay allows for more recently run jobs to have more weight than jobs that ran earlier. Consider adjusting this number if you have jobs that (on average) run longer than ten minutes, or a large difference in job count or job run times between share identifiers, and the allocation of resources doesn't meet your needs.
computeReservation (integer) --
A value used to reserve some of the available maximum vCPU for share identifiers that aren't already used.
The reserved ratio is (computeReservation/100)^ActiveFairShares where ActiveFairShares is the number of active share identifiers.
For example, a computeReservation value of 50 indicates that Batch reserves 50% of the maximum available vCPU if there's only one share identifier. It reserves 25% if there are two share identifiers. It reserves 12.5% if there are three share identifiers. A computeReservation value of 25 indicates that Batch should reserve 25% of the maximum available vCPU if there's only one share identifier, 6.25% if there are two fair share identifiers, and 1.56% if there are three share identifiers.
The minimum value is 0 and the maximum value is 99.
shareDistribution (list) --
An array of SharedIdentifier objects that contain the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
(dict) --
Specifies the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
shareIdentifier (string) --
A share identifier or share identifier prefix. If the string ends with an asterisk (*), this entry specifies the weight factor to use for share identifiers that start with that prefix. The list of share identifiers in a fair-share policy can't overlap. For example, you can't have one that specifies a shareIdentifier of UserA* and another that specifies a shareIdentifier of UserA1.
There can be no more than 500 share identifiers active in a job queue.
The string is limited to 255 alphanumeric characters, and can be followed by an asterisk (*).
weightFactor (float) --
The weight factor for the share identifier. The default value is 1.0. A lower value has a higher priority for compute resources. For example, jobs that use a share identifier with a weight factor of 0.125 (1/8) get 8 times the compute resources of jobs that use a share identifier with a weight factor of 1.
The smallest supported value is 0.0001, and the largest supported value is 999.9999.
tags (dict) --
The tags that you apply to the fair-share scheduling policy to categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging Amazon Web Services resources in Amazon Web Services General Reference.
(string) --
(string) --
{'preemptionConfiguration': {'preemptionRetriesBeforeTermination': 'integer'},
'preemptionSummary': {'preemptedAttemptCount': 'integer',
'recentPreemptedAttempts': [{'serviceResourceId': {'name': 'TrainingJobArn',
'value': 'string'},
'startedAt': 'long',
'statusReason': 'string',
'stoppedAt': 'long'}]},
'quotaShareName': 'string'}
The details of a service job.
See also: AWS API Documentation
Request Syntax
client.describe_service_job(
jobId='string'
)
string
[REQUIRED]
The job ID for the service job to describe.
dict
Response Syntax
{
'attempts': [
{
'serviceResourceId': {
'name': 'TrainingJobArn',
'value': 'string'
},
'startedAt': 123,
'stoppedAt': 123,
'statusReason': 'string'
},
],
'capacityUsage': [
{
'capacityUnit': 'string',
'quantity': 123.0
},
],
'createdAt': 123,
'isTerminated': True|False,
'jobArn': 'string',
'jobId': 'string',
'jobName': 'string',
'jobQueue': 'string',
'latestAttempt': {
'serviceResourceId': {
'name': 'TrainingJobArn',
'value': 'string'
}
},
'retryStrategy': {
'attempts': 123,
'evaluateOnExit': [
{
'action': 'RETRY'|'EXIT',
'onStatusReason': 'string'
},
]
},
'scheduledAt': 123,
'schedulingPriority': 123,
'serviceRequestPayload': 'string',
'serviceJobType': 'SAGEMAKER_TRAINING',
'shareIdentifier': 'string',
'quotaShareName': 'string',
'preemptionConfiguration': {
'preemptionRetriesBeforeTermination': 123
},
'preemptionSummary': {
'preemptedAttemptCount': 123,
'recentPreemptedAttempts': [
{
'serviceResourceId': {
'name': 'TrainingJobArn',
'value': 'string'
},
'startedAt': 123,
'stoppedAt': 123,
'statusReason': 'string'
},
]
},
'startedAt': 123,
'status': 'SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
'statusReason': 'string',
'stoppedAt': 123,
'tags': {
'string': 'string'
},
'timeoutConfig': {
'attemptDurationSeconds': 123
}
}
Response Structure
(dict) --
attempts (list) --
A list of job attempts associated with the service job.
(dict) --
Detailed information about an attempt to run a service job.
serviceResourceId (dict) --
The service resource identifier associated with the service job attempt.
name (string) --
The name of the resource identifier.
value (string) --
The value of the resource identifier.
startedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job attempt was started.
stoppedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job attempt stopped running.
statusReason (string) --
A string that provides additional details for the current status of the service job attempt.
capacityUsage (list) --
The configured capacity for the service job, such as the number of instances. The number of instances should be the same value as the serviceRequestPayload.InstanceCount field.
(dict) --
The capacity usage for a service job, including the unit of measure and quantity of resources being consumed.
capacityUnit (string) --
The unit of measure for the service job capacity usage. For service jobs, this is the instance type.
quantity (float) --
The quantity of capacity being used by the service job, measured in the units specified by capacityUnit.
createdAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was created.
isTerminated (boolean) --
Indicates whether the service job has been terminated.
jobArn (string) --
The Amazon Resource Name (ARN) of the service job.
jobId (string) --
The job ID for the service job.
jobName (string) --
The name of the service job.
jobQueue (string) --
The ARN of the job queue that the service job is associated with.
latestAttempt (dict) --
The latest attempt associated with the service job.
serviceResourceId (dict) --
The service resource identifier associated with the service job attempt.
name (string) --
The name of the resource identifier.
value (string) --
The value of the resource identifier.
retryStrategy (dict) --
The retry strategy to use for failed service jobs that are submitted with this service job.
attempts (integer) --
The number of times to move a service job to RUNNABLE status. You can specify between 1 and 10 attempts.
evaluateOnExit (list) --
Array of ServiceJobEvaluateOnExit objects that specify conditions under which the service job should be retried or failed.
(dict) --
Specifies conditions for when to exit or retry a service job based on the exit status or status reason.
action (string) --
The action to take if the service job exits with the specified condition. Valid values are RETRY and EXIT.
onStatusReason (string) --
Contains a glob pattern to match against the StatusReason returned for a job. The pattern can contain up to 512 characters and can contain all printable characters. It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.
scheduledAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was scheduled. This represents when the service job was dispatched to SageMaker and the service job transitioned to the SCHEDULED state.
schedulingPriority (integer) --
The scheduling priority of the service job.
serviceRequestPayload (string) --
The request, in JSON, for the service that the SubmitServiceJob operation is queueing.
serviceJobType (string) --
The type of service job. For SageMaker Training jobs, this value is SAGEMAKER_TRAINING.
shareIdentifier (string) --
The share identifier for the service job. This is used for fair-share scheduling.
quotaShareName (string) --
The name of the quota share that the service job is associated with.
preemptionConfiguration (dict) --
Specifies the service job behavior when preempted.
preemptionRetriesBeforeTermination (integer) --
The number of times a service job can be retried after it is preempted. A job will be terminated when preemption retries have been exhausted. If this field is unset, preempted jobs will be requeued an unlimited number of times.
preemptionSummary (dict) --
Summarizes the preemptions of the service job. This field appears on a service job when it has been preempted.
preemptedAttemptCount (integer) --
The total number of times the service job has been preempted.
recentPreemptedAttempts (list) --
A list of the most recent preemption attempts for the service job.
(dict) --
Detailed information about a preempted attempt of a service job.
serviceResourceId (dict) --
The service resource identifier associated with the service job attempt.
name (string) --
The name of the resource identifier.
value (string) --
The value of the resource identifier.
startedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job attempt was started.
stoppedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job attempt stopped running.
statusReason (string) --
A string that provides additional details for the current status of the service job attempt.
startedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was started.
status (string) --
The current status of the service job.
statusReason (string) --
A short, human-readable string to provide more details for the current status of the service job.
stoppedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job stopped running.
tags (dict) --
The tags that are associated with the service job. Each tag consists of a key and an optional value. For more information, see Tagging your Batch resources.
(string) --
(string) --
timeoutConfig (dict) --
The timeout configuration for the service job.
attemptDurationSeconds (integer) --
The maximum duration in seconds that a service job attempt can run. After this time is reached, Batch terminates the service job attempt.
{'frontOfQuotaShares': {'lastUpdatedAt': 'long',
'quotaShares': {'string': [{'earliestTimeAtPosition': 'long',
'jobArn': 'string'}]}},
'queueUtilization': {'quotaShareUtilization': {'topCapacityUtilization': [{'capacityUsage': [{'capacityUnit': 'string',
'quantity': 'double'}],
'quotaShareName': 'string'}]}}}
Provides a snapshot of job queue state, including ordering of RUNNABLE jobs, as well as capacity utilization for already dispatched jobs. The first 100 RUNNABLE jobs in the job queue are listed in order of dispatch. For job queues with an attached quota-share policy, the first RUNNABLE job in each quota share is also listed. Capacity utilization for the job queue is provided, as well as break downs by share for job queues with attached fair-share or quota-share scheduling policies.
See also: AWS API Documentation
Request Syntax
client.get_job_queue_snapshot(
jobQueue='string'
)
string
[REQUIRED]
The job queue’s name or full queue Amazon Resource Name (ARN).
dict
Response Syntax
{
'frontOfQueue': {
'jobs': [
{
'jobArn': 'string',
'earliestTimeAtPosition': 123
},
],
'lastUpdatedAt': 123
},
'frontOfQuotaShares': {
'quotaShares': {
'string': [
{
'jobArn': 'string',
'earliestTimeAtPosition': 123
},
]
},
'lastUpdatedAt': 123
},
'queueUtilization': {
'totalCapacityUsage': [
{
'capacityUnit': 'string',
'quantity': 123.0
},
],
'fairshareUtilization': {
'activeShareCount': 123,
'topCapacityUtilization': [
{
'shareIdentifier': 'string',
'capacityUsage': [
{
'capacityUnit': 'string',
'quantity': 123.0
},
]
},
]
},
'quotaShareUtilization': {
'topCapacityUtilization': [
{
'quotaShareName': 'string',
'capacityUsage': [
{
'capacityUnit': 'string',
'quantity': 123.0
},
]
},
]
},
'lastUpdatedAt': 123
}
}
Response Structure
(dict) --
frontOfQueue (dict) --
The list of the first 100 RUNNABLE jobs in each job queue. For first-in-first-out (FIFO) job queues, jobs are ordered based on their submission time. For job queues with an attached fair-share scheduling (FSS) or quota-share policy, jobs are ordered based on their job priority and share usage.
jobs (list) --
The Amazon Resource Names (ARNs) of the first 100 RUNNABLE jobs in a named job queue. For first-in-first-out (FIFO) job queues, jobs are ordered based on their submission time. For fair-share scheduling (FSS) job queues, jobs are ordered based on their job priority and share usage.
(dict) --
An object that represents summary details for the first 100 RUNNABLE jobs in a job queue.
jobArn (string) --
The ARN for a job in a named job queue.
earliestTimeAtPosition (integer) --
The Unix timestamp (in milliseconds) for when the job transitioned to its current position in the job queue.
lastUpdatedAt (integer) --
The Unix timestamp (in milliseconds) for when each of the first 100 RUNNABLE jobs were last updated.
frontOfQuotaShares (dict) --
The first RUNNABLE job in each quota share. Jobs are ordered based on their job priority and share usage.
quotaShares (dict) --
Contains a list of the first RUNNABLE job in each named quota share.
(string) --
(list) --
(dict) --
An object that represents summary details for the first RUNNABLE job in a quota share.
jobArn (string) --
The ARN for a job in a named quota share.
earliestTimeAtPosition (integer) --
The Unix timestamp (in milliseconds) for when the job transitioned to its current position in the quota share.
lastUpdatedAt (integer) --
The Unix timestamp (in milliseconds) for when the first RUNNABLE job per quota share were all last updated.
queueUtilization (dict) --
The job queue's capacity utilization, including total usage and breakdown per given share.
totalCapacityUsage (list) --
The total capacity usage for the entire job queue.
(dict) --
The configured capacity usage for a job queue snapshot, including the unit of measure and quantity of resources being used.
capacityUnit (string) --
The unit of measure for the capacity usage. For compute jobs, this is VCPU for Amazon EC2 and cpu for Amazon EKS. For service jobs, this is the instance type.
quantity (float) --
The quantity of capacity being used in the queue snapshot, measured in the units specified by capacityUnit.
fairshareUtilization (dict) --
The utilization information for a fairshare scheduling job queues, including active share count and top capacity utilization by share.
activeShareCount (integer) --
The total number of active shares in the fairshare scheduling job queue that are currently utilizing capacity.
topCapacityUtilization (list) --
A list of the top 20 shares with the highest capacity utilization, ordered by usage amount.
(dict) --
The capacity utilization for a specific share in a fairshare scheduling job queue, including the share identifier and its current usage.
shareIdentifier (string) --
The share identifier for the fairshare scheduling job queue.
capacityUsage (list) --
The capacity usage information for this share, including the unit of measure and quantity being used. This is VCPU for Amazon EC2 and cpu for Amazon EKS.
(dict) --
The capacity usage for a fairshare scheduling job queue.
capacityUnit (string) --
The unit of measure for the capacity usage. For compute jobs, this is VCPU for Amazon EC2 and cpu for Amazon EKS. For service jobs, this is the instance type.
quantity (float) --
The quantity of capacity being used, measured in the units specified by capacityUnit.
quotaShareUtilization (dict) --
The utilization information for a job queue with a quota share scheduling policy.
topCapacityUtilization (list) --
A list of the top capacity utilizations across quota shares associated with a job queue.
(dict) --
The capacity utilization for a specific quota share, including the quota share name and its current usage.
quotaShareName (string) --
The name of the quota share.
capacityUsage (list) --
The capacity usage information for this quota share, including the units of compute capacity and quantity being used.
(dict) --
The capacity usage for a quota share, including units of compute capacity and quantity of resources being used.
capacityUnit (string) --
The unit of compute capacity for the capacity usage.
quantity (float) --
The quantity of capacity being used.
lastUpdatedAt (integer) --
The Unix timestamp (in milliseconds) for when the queue utilization information was last updated.
{'jobSummaryList': {'quotaShareName': 'string'}}
Returns a list of service jobs for a specified job queue.
See also: AWS API Documentation
Request Syntax
client.list_service_jobs(
jobQueue='string',
jobStatus='SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
maxResults=123,
nextToken='string',
filters=[
{
'name': 'string',
'values': [
'string',
]
},
]
)
string
The name or ARN of the job queue with which to list service jobs.
string
The job status used to filter service jobs in the specified queue. If the filters parameter is specified, the jobStatus parameter is ignored and jobs with any status are returned. The exception is the SHARE_IDENTIFIER filter and jobStatus can be used together. If you don't specify a status, only RUNNING jobs are returned.
integer
The maximum number of results returned by ListServiceJobs in paginated output. When this parameter is used, ListServiceJobs only returns maxResults results in a single page and a nextToken response element. The remaining results of the initial request can be seen by sending another ListServiceJobs request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListServiceJobs returns up to 100 results and a nextToken value if applicable.
string
The nextToken value returned from a previous paginated ListServiceJobs request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.
list
The filter to apply to the query. Only one filter can be used at a time. When the filter is used, jobStatus is ignored with the exception that SHARE_IDENTIFIER and jobStatus can be used together. The results are sorted by the createdAt field, with the most recent jobs being first.
The value of the filter is a case-insensitive match for the job name. If the value ends with an asterisk (*), the filter matches any job name that begins with the string before the '*'. This corresponds to the jobName value. For example, test1 matches both Test1 and test1, and test1* matches both test1 and Test10. When the JOB_NAME filter is used, the results are grouped by the job name and version.
BEFORE_CREATED_AT
The value for the filter is the time that's before the job was created. This corresponds to the createdAt value. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970.
AFTER_CREATED_AT
The value for the filter is the time that's after the job was created. This corresponds to the createdAt value. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970.
SHARE_IDENTIFIER
The value for the filter is the fairshare scheduling share identifier.
(dict) --
A filter name and value pair that's used to return a more specific list of results from a ListJobs or ListJobsByConsumableResource API operation.
name (string) --
The name of the filter. Filter names are case sensitive.
values (list) --
The filter values.
(string) --
dict
Response Syntax
{
'jobSummaryList': [
{
'latestAttempt': {
'serviceResourceId': {
'name': 'TrainingJobArn',
'value': 'string'
}
},
'capacityUsage': [
{
'capacityUnit': 'string',
'quantity': 123.0
},
],
'createdAt': 123,
'jobArn': 'string',
'jobId': 'string',
'jobName': 'string',
'scheduledAt': 123,
'serviceJobType': 'SAGEMAKER_TRAINING',
'shareIdentifier': 'string',
'quotaShareName': 'string',
'status': 'SUBMITTED'|'PENDING'|'RUNNABLE'|'SCHEDULED'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
'statusReason': 'string',
'startedAt': 123,
'stoppedAt': 123
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
jobSummaryList (list) --
A list of service job summaries.
(dict) --
Summary information about a service job.
latestAttempt (dict) --
Information about the latest attempt for the service job.
serviceResourceId (dict) --
The service resource identifier associated with the service job attempt.
name (string) --
The name of the resource identifier.
value (string) --
The value of the resource identifier.
capacityUsage (list) --
The capacity usage information for this service job, including the unit of measure and quantity of resources being used.
(dict) --
The capacity usage for a service job, including the unit of measure and quantity of resources being used.
capacityUnit (string) --
The unit of measure for the service job capacity usage. For service jobs, this is the instance type.
quantity (float) --
The quantity of capacity being used by the service job, measured in the units specified by capacityUnit.
createdAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was created.
jobArn (string) --
The Amazon Resource Name (ARN) of the service job.
jobId (string) --
The job ID for the service job.
jobName (string) --
The name of the service job.
scheduledAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was scheduled for execution.
serviceJobType (string) --
The type of service job. For SageMaker Training jobs, this value is SAGEMAKER_TRAINING.
shareIdentifier (string) --
The share identifier for the job.
quotaShareName (string) --
The quota share for the service job.
status (string) --
The current status of the service job.
statusReason (string) --
A short string to provide more details on the current status of the service job.
startedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job was started.
stoppedAt (integer) --
The Unix timestamp (in milliseconds) for when the service job stopped running.
nextToken (string) --
The nextToken value to include in a future ListServiceJobs request. When the results of a ListServiceJobs request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.
{'preemptionConfiguration': {'preemptionRetriesBeforeTermination': 'integer'},
'quotaShareName': 'string'}
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.
See also: AWS API Documentation
Request Syntax
client.submit_service_job(
jobName='string',
jobQueue='string',
retryStrategy={
'attempts': 123,
'evaluateOnExit': [
{
'action': 'RETRY'|'EXIT',
'onStatusReason': 'string'
},
]
},
schedulingPriority=123,
serviceRequestPayload='string',
serviceJobType='SAGEMAKER_TRAINING',
shareIdentifier='string',
quotaShareName='string',
preemptionConfiguration={
'preemptionRetriesBeforeTermination': 123
},
timeoutConfig={
'attemptDurationSeconds': 123
},
tags={
'string': 'string'
},
clientToken='string'
)
string
[REQUIRED]
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 (_).
string
[REQUIRED]
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.
dict
The retry strategy to use for failed service jobs that are submitted with this service job request.
attempts (integer) -- [REQUIRED]
The number of times to move a service job to RUNNABLE status. You can specify between 1 and 10 attempts.
evaluateOnExit (list) --
Array of ServiceJobEvaluateOnExit objects that specify conditions under which the service job should be retried or failed.
(dict) --
Specifies conditions for when to exit or retry a service job based on the exit status or status reason.
action (string) --
The action to take if the service job exits with the specified condition. Valid values are RETRY and EXIT.
onStatusReason (string) --
Contains a glob pattern to match against the StatusReason returned for a job. The pattern can contain up to 512 characters and can contain all printable characters. It can optionally end with an asterisk (*) so that only the start of the string needs to be an exact match.
integer
The scheduling priority of the service job. Valid values are integers between 0 and 9999.
string
[REQUIRED]
The request, in JSON, for the service that the SubmitServiceJob operation is queueing.
string
[REQUIRED]
The type of service job. For SageMaker Training jobs, specify SAGEMAKER_TRAINING.
string
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.
string
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.
dict
Specifies the service job behavior when preempted.
preemptionRetriesBeforeTermination (integer) --
The number of times a service job can be retried after it is preempted. A job will be terminated when preemption retries have been exhausted. If this field is unset, preempted jobs will be requeued an unlimited number of times.
dict
The timeout configuration for the service job. If none is specified, Batch defers to the default timeout of the underlying service handling the job.
attemptDurationSeconds (integer) --
The maximum duration in seconds that a service job attempt can run. After this time is reached, Batch terminates the service job attempt.
dict
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.
(string) --
(string) --
string
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 ``clientToken``s are received, these requests are considered the same request and the second request is rejected.
This field is autopopulated if not provided.
dict
Response Syntax
{
'jobArn': 'string',
'jobName': 'string',
'jobId': 'string'
}
Response Structure
(dict) --
jobArn (string) --
The Amazon Resource Name (ARN) for the service job.
jobName (string) --
The name of the service job.
jobId (string) --
The unique identifier for the service job.
{'quotaSharePolicy': {'idleResourceAssignmentStrategy': 'FIFO'}}
Updates a scheduling policy.
See also: AWS API Documentation
Request Syntax
client.update_scheduling_policy(
arn='string',
quotaSharePolicy={
'idleResourceAssignmentStrategy': 'FIFO'
},
fairsharePolicy={
'shareDecaySeconds': 123,
'computeReservation': 123,
'shareDistribution': [
{
'shareIdentifier': 'string',
'weightFactor': ...
},
]
}
)
string
[REQUIRED]
The Amazon Resource Name (ARN) of the scheduling policy to update.
dict
The quota share scheduling policy details. Once set during creation, a quotaSharePolicy cannot be removed or changed to a fairsharePolicy.
idleResourceAssignmentStrategy (string) -- [REQUIRED]
The strategy that determines how idle resources are assigned to quota shares that are borrowing capacity. Currently, only FIFO is supported.
dict
The fair-share policy scheduling details. Once set during creation, a fairsharePolicy cannot be removed or changed to a quotaSharePolicy.
shareDecaySeconds (integer) --
The amount of time (in seconds) to use to calculate a fair-share percentage for each share identifier in use. A value of zero (0) indicates the default minimum time window (600 seconds). The maximum supported value is 604800 (1 week).
The decay allows for more recently run jobs to have more weight than jobs that ran earlier. Consider adjusting this number if you have jobs that (on average) run longer than ten minutes, or a large difference in job count or job run times between share identifiers, and the allocation of resources doesn't meet your needs.
computeReservation (integer) --
A value used to reserve some of the available maximum vCPU for share identifiers that aren't already used.
The reserved ratio is (computeReservation/100)^ActiveFairShares where ActiveFairShares is the number of active share identifiers.
For example, a computeReservation value of 50 indicates that Batch reserves 50% of the maximum available vCPU if there's only one share identifier. It reserves 25% if there are two share identifiers. It reserves 12.5% if there are three share identifiers. A computeReservation value of 25 indicates that Batch should reserve 25% of the maximum available vCPU if there's only one share identifier, 6.25% if there are two fair share identifiers, and 1.56% if there are three share identifiers.
The minimum value is 0 and the maximum value is 99.
shareDistribution (list) --
An array of SharedIdentifier objects that contain the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
(dict) --
Specifies the weights for the share identifiers for the fair-share policy. Share identifiers that aren't included have a default weight of 1.0.
shareIdentifier (string) -- [REQUIRED]
A share identifier or share identifier prefix. If the string ends with an asterisk (*), this entry specifies the weight factor to use for share identifiers that start with that prefix. The list of share identifiers in a fair-share policy can't overlap. For example, you can't have one that specifies a shareIdentifier of UserA* and another that specifies a shareIdentifier of UserA1.
There can be no more than 500 share identifiers active in a job queue.
The string is limited to 255 alphanumeric characters, and can be followed by an asterisk (*).
weightFactor (float) --
The weight factor for the share identifier. The default value is 1.0. A lower value has a higher priority for compute resources. For example, jobs that use a share identifier with a weight factor of 0.125 (1/8) get 8 times the compute resources of jobs that use a share identifier with a weight factor of 1.
The smallest supported value is 0.0001, and the largest supported value is 999.9999.
dict
Response Syntax
{}
Response Structure
(dict) --