A Job runs short-lived, one-off batch tasks and ensures that one or more pods in the batch complete successfully. Job workloads can be created in the Alibaba Cloud Container Compute Service (ACS) console.
Background information
Jobs are classified into the following types based on the .spec.completions and .spec.parallelism settings:
.spec.completions is the number of pods that must complete successfully. Default value: 1. .spec.parallelism is the maximum number of replicas that a Job can run in parallel. Default value: 1.
Job type | completions | parallelism | Example | Behavior |
One-off Job | 1 | 1 | Database migration | Runs one pod until it completes successfully. |
Job with a fixed completion count | 2+ | 1 | Pods that process a work queue | Pods run one after another until the number of pods that complete successfully reaches the value of |
Parallel Job with a work queue | 1 | 2+ | Multiple pods that process a work queue at the same time, with no required success count | Multiple pods run in parallel until one pod completes successfully. |
Parallel Job with a fixed completion count | 2+ | 2+ | Multiple pods that process a work queue at the same time, with a required success count | Multiple pods run in parallel until the number of pods that complete successfully reaches the value of |
Procedure
Step 1: Configure basic application information
-
Log on to the ACS console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of the target cluster, or click Details in the Actions column.
In the left navigation pane of the cluster details page, choose .
On the Jobs page, click Create from Image.
On the Basic Information wizard page, configure the basic information of the application.
Parameter
Description
Application Name
Enter a name for the application.
Type
Select Job.
Label
Add a label to identify the application.
Annotations
Add an annotation to the application.
Instance Type
Select a compute type. For details about compute types, see Overview of ACS pod instances.
QoS Type
Select a Quality of Service (QoS) class.
After you configure the basic information, click Next.
Step 2: Configure containers
On the Container wizard page, configure the container image, resources, ports, environment variables, lifecycle, volumes, and logging.
To add multiple containers to the pod, click Add Container next to the Container 1 tab.
Step 3: Complete advanced configuration
In the Job Settings section, configure the Job parameters.
Parameter
Description
Completions
Corresponds to completions. Specifies the number of pods that must complete successfully. Default value: 1.
Parallelism
Corresponds to parallelism. Specifies the maximum number of pods that the Job can run concurrently. Default value: 1.
Timeout
Corresponds to activeDeadlineSeconds. Specifies how long the Job is allowed to run. Unit: seconds. Valid values: positive integers. If you do not set this parameter, the Job runs without a deadline. If the Job does not finish within this period, the system attempts to stop it.
BackoffLimit
The number of attempts to recreate a pod after it fails to run. Default value: 6. Each retry after a failure is delayed, and the delay grows exponentially up to a maximum of 6 minutes.
Restart
Only Never (Never) and On Failure (OnFailure) are supported.
ImportantIf the timeout is shorter than the time that the Job pods need, the Job ends before the pods complete and the work in progress is lost. If the timeout is longer than needed, a pod that hangs keeps consuming billable compute resources until the deadline expires.
(Optional) In the Labels and Annotations section, click Add to set labels and annotations for the pod.
Click Create.
Step 4: View application information
After the application is created, the completion page is displayed by default. Click View Details to go to the details page of the Job.
Information about the Job is also available on the Jobs page. Click the name of the target Job, or in the Actions column, click Details to go to the application details page.