Merge pull request #35035 from windsonsea/static

[zh-cn] updated /tasks/job/indexed-parallel-processing-static.md
This commit is contained in:
Kubernetes Prow Robot
2022-07-15 06:40:53 -07:00
committed by GitHub
@@ -15,7 +15,6 @@ weight: 30
<!-- overview --> <!-- overview -->
<!-- <!--
In this example, you will run a Kubernetes Job that uses multiple parallel In this example, you will run a Kubernetes Job that uses multiple parallel
worker processes. worker processes.
@@ -25,7 +24,7 @@ to identify which part of the overall task to work on.
--> -->
在此示例中,你将运行一个使用多个并行工作进程的 Kubernetes Job。 在此示例中,你将运行一个使用多个并行工作进程的 Kubernetes Job。
每个 worker 都是在自己的 Pod 中运行的不同容器。 每个 worker 都是在自己的 Pod 中运行的不同容器。
Pod 具有控制平面自动设置的 _索引编号(index number_ Pod 具有控制平面自动设置的**索引编号(index number**
这些编号使得每个 Pod 能识别出要处理整个任务的哪个部分。 这些编号使得每个 Pod 能识别出要处理整个任务的哪个部分。
<!-- <!--
@@ -55,7 +54,7 @@ Here is an overview of the steps in this example:
以下是此示例中步骤的概述: 以下是此示例中步骤的概述:
1. **定义使用带索引完成信息的 Job 清单** 1. **定义使用带索引完成信息的 Job 清单**
Downward API 使你可以将 Pod 索引注作为环境变量或文件传递给容器。 Downward API 使你可以将 Pod 索引注作为环境变量或文件传递给容器。
2. **根据该清单启动一个带索引(`Indexed`)的 Job** 2. **根据该清单启动一个带索引(`Indexed`)的 Job**
## {{% heading "prerequisites" %}} ## {{% heading "prerequisites" %}}
@@ -111,7 +110,7 @@ rev data.txt
You'll use the `rev` tool from the You'll use the `rev` tool from the
[`busybox`](https://hub.docker.com/_/busybox) container image. [`busybox`](https://hub.docker.com/_/busybox) container image.
--> -->
你将使用 [`busybox`](https://hub.docker.com/_/busybox) 容器像中的 `rev` 工具。 你将使用 [`busybox`](https://hub.docker.com/_/busybox) 容器像中的 `rev` 工具。
<!-- <!--
As this is only an example, each Pod only does a tiny piece of work (reversing a short As this is only an example, each Pod only does a tiny piece of work (reversing a short
@@ -124,8 +123,8 @@ the Job knows which frame to render and publish, by counting frames from
the start of the clip. the start of the clip.
--> -->
由于这只是一个例子,每个 Pod 只做一小部分工作(反转一个短字符串)。 由于这只是一个例子,每个 Pod 只做一小部分工作(反转一个短字符串)。
例如,在实际工作负载中,你可能会创建一个表示基于场景数据制作 60 秒视频任务的 Job 。 例如,在实际工作负载中,你可能会创建一个表示基于场景数据制作 60 秒视频任务的 Job 。
视频渲染 Job 中的每个工作项都将渲染该视频剪辑的特定帧。 视频渲染 Job 中的每个工作项都将渲染该视频剪辑的特定帧。
索引完成意味着 Job 中的每个 Pod 都知道通过从剪辑开始计算帧数,来确定渲染和发布哪一帧,。 索引完成意味着 Job 中的每个 Pod 都知道通过从剪辑开始计算帧数,来确定渲染和发布哪一帧,。
<!-- ## Define an Indexed Job --> <!-- ## Define an Indexed Job -->
@@ -187,14 +186,14 @@ Because `.spec.parallelism` is less than `.spec.completions`, the control plane
Once you have created the Job, wait a moment then check on progress: Once you have created the Job, wait a moment then check on progress:
--> -->
当你创建此 Job 时,控制平面会创建一系列 Pod,每个索引都由你指定 当你创建此 Job 时,控制平面会创建一系列 Pod,你指定的每个索引都会运行一个 Pod
`.spec.parallelism` 的值决定了一次可以运行多少个, `.spec.parallelism` 的值决定了一次可以运行多少个 Pod
`.spec.completions` 决定了 Job 总共创建了多少个 Pod。 `.spec.completions` 决定了 Job 总共创建了多少个 Pod。
因为 `.spec.parallelism` 小于 `.spec.completions` 因为 `.spec.parallelism` 小于 `.spec.completions`
控制平面在启动更多 Pod 之前,等待部分第一批 Pod 完成。 所以控制平面在启动更多 Pod 之前,等待第一批的某些 Pod 完成。
创建 Job 后,稍等片刻,然后检查进度: 创建 Job 后,稍等片刻,就能检查进度:
```shell ```shell
kubectl describe jobs/indexed-job kubectl describe jobs/indexed-job