createJobQueue
inline suspend fun BatchClient.createJobQueue(crossinline block: CreateJobQueueRequest.Builder.() -> Unit): CreateJobQueueResponse
Creates an Batch job queue. When you create a job queue, you associate one or more compute environments to the queue and assign an order of preference for the compute environments.
You also set a priority to the job queue that determines the order that the Batch scheduler places jobs onto its associated compute environments. For example, if a compute environment is associated with more than one job queue, the job queue with a higher priority is given preference for scheduling jobs to that compute environment.
Samples
import aws.sdk.kotlin.services.batch.model.ComputeEnvironmentOrder
import aws.sdk.kotlin.services.batch.model.JqState
fun main() {
//sampleStart
// This example creates a job queue called LowPriority that uses the M4Spot compute environment.
val resp = batchClient.createJobQueue {
priority = 1
state = JqState.fromValue("ENABLED")
computeEnvironmentOrder = listOf<ComputeEnvironmentOrder>(
ComputeEnvironmentOrder {
computeEnvironment = "M4Spot"
order = 1
}
)
jobQueueName = "LowPriority"
}
//sampleEnd
}
import aws.sdk.kotlin.services.batch.model.ComputeEnvironmentOrder
import aws.sdk.kotlin.services.batch.model.JqState
fun main() {
//sampleStart
// This example creates a job queue called HighPriority that uses the C4OnDemand compute environment
// with an order of 1 and the M4Spot compute environment with an order of 2.
val resp = batchClient.createJobQueue {
priority = 10
state = JqState.fromValue("ENABLED")
computeEnvironmentOrder = listOf<ComputeEnvironmentOrder>(
ComputeEnvironmentOrder {
computeEnvironment = "C4OnDemand"
order = 1
},
ComputeEnvironmentOrder {
computeEnvironment = "M4Spot"
order = 2
}
)
jobQueueName = "HighPriority"
}
//sampleEnd
}