This tutorial describes the basic features of a Job by creating a parallel task to perform a simple calculation and outputting PI to 2000 decimal as an example.
project-regular
and enter into the corresponding project.About 10 minutes.
Enter into the project, navigate to Wordloads → Jobs, then click Create Job.
Fill in the basic information, e.g. Name : job-demo
. Then choose Next when you're done.
Fill the job settings with the following values of the screenshot.
Leave the RestartPolicy as Never, then click Add Container.
Fill in the Pod Template, Container Name can be customized by the user, fill in the image with perl
, other blanks could be remained default values.
Choose Advanced Options.
Then click Add Command, add the following four lines of commands in sequence, that is, perform a simple calculation and outputting the Pi to 2000 decimal.
# Command
perl
-Mbignum=bpi
-wle
print bpi(2000)
Then choose Save and click Next when you're done.
Skip the Volume Settings and click Next to the Label Settings. We simply keep the default label settings as app: job-demo
.
Then choose Create when you're done, you will be able to see the job-demo has been created successfully which displays running.
job-demo
and view the execution records, we can see it displays "completed (4/4)" and there are four Pods completed running, since the completions
are set to four in the Step 2.job-demo
. Since the Parallelism is set to 2, the Job will create 2 Pods in advance, then continue to create 2 Pods in parallel, finally 4 Pods will be created at the end of the Job.job-demo-7vkcz
, then click Container Logs
to view its container logs.