sigs.k8s.io/kueue@v0.6.2/site/content/en/docs/tasks/run_jobsets.md (about) 1 --- 2 title: "Run A JobSet" 3 date: 2023-06-16 4 weight: 7 5 description: > 6 Run a Kueue scheduled JobSet. 7 --- 8 9 This document explains how you can use Kueue’s scheduling and resource management functionality when running [JobSet Operator](https://github.com/kubernetes-sigs/jobset) [JobSets](https://github.com/kubernetes-sigs/jobset/blob/main/docs/concepts/README.md). 10 11 This guide is for [batch users](/docs/tasks#batch-user) that have a basic understanding of Kueue. For more information, see [Kueue's overview](/docs/overview). 12 13 ## Before you begin 14 15 1. Check [Administer cluster quotas](/docs/tasks/administer_cluster_quotas) for details on the initial Kueue setup. 16 17 2. See [JobSet Installation](https://github.com/kubernetes-sigs/jobset/blob/main/docs/setup/install.md) for installation and configuration details of JobSet Operator. 18 19 ## JobSet definition 20 21 When running [JobSets](https://github.com/kubernetes-sigs/jobset/blob/main/docs/concepts/README.md) on 22 Kueue, take into consideration the following aspects: 23 24 ### a. Queue selection 25 26 The target [local queue](/docs/concepts/local_queue) should be specified in the `metadata.labels` section of the JobSet configuration. 27 28 ```yaml 29 metadata: 30 labels: 31 kueue.x-k8s.io/queue-name: user-queue 32 ``` 33 34 ### b. Configure the resource needs 35 36 The resource needs of the workload can be configured in the `spec.replicatedJobs`. Should also be taken into account that number of replicas, [parallelism](https://kubernetes.io/docs/concepts/workloads/controllers/job/#parallel-jobs) and completions affect the resource calculations. 37 38 ```yaml 39 - replicas: 1 40 template: 41 spec: 42 completions: 2 43 parallelism: 2 44 template: 45 spec: 46 containers: 47 - resources: 48 requests: 49 cpu: 1 50 ``` 51 52 ### c. Jobs prioritisation 53 54 The first [PriorityClassName](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass) of `spec.replicatedJobs` that is not empty will be used as the priority. 55 56 ```yaml 57 - template: 58 spec: 59 template: 60 spec: 61 priorityClassName: high-priority 62 ``` 63 64 ## Example JobSet 65 66 The JobSet looks like the following: 67 68 ```yaml 69 # jobset-sample.yaml 70 apiVersion: jobset.x-k8s.io/v1alpha2 71 kind: JobSet 72 metadata: 73 generateName: sleep-job- 74 labels: 75 kueue.x-k8s.io/queue-name: user-queue 76 spec: 77 network: 78 enableDNSHostnames: false 79 subdomain: some-subdomain 80 replicatedJobs: 81 - name: workers 82 replicas: 2 83 template: 84 spec: 85 parallelism: 4 86 completions: 4 87 backoffLimit: 0 88 template: 89 spec: 90 containers: 91 - name: sleep 92 image: busybox 93 resources: 94 requests: 95 cpu: 1 96 memory: "200Mi" 97 command: 98 - sleep 99 args: 100 - 100s 101 - name: driver 102 template: 103 spec: 104 parallelism: 1 105 completions: 1 106 backoffLimit: 0 107 template: 108 spec: 109 containers: 110 - name: sleep 111 image: busybox 112 resources: 113 requests: 114 cpu: 2 115 memory: "200Mi" 116 command: 117 - sleep 118 args: 119 - 100s 120 ``` 121 122 You can run this JobSet with the following commands: 123 124 ```sh 125 # To monitor the queue and admission of the jobs, you can run this example multiple times: 126 kubectl create -f jobset-sample.yaml 127 ```