Merge pull request #36616 from yanrongshi/zh-cn]Sync-docs/tasks/job/indexed-parallel-processing-static.md
[zh-cn]Sync /docs/tasks/job/indexed-parallel-processing-static.mdpull/36648/head
commit
9236e53cca
|
@ -59,7 +59,7 @@ Here is an overview of the steps in this example:
|
|||
|
||||
## {{% heading "prerequisites" %}}
|
||||
|
||||
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
|
||||
{{< include "task-tutorial-prereqs.md" >}}
|
||||
|
||||
<!--
|
||||
Be familiar with the basic,
|
||||
|
@ -195,12 +195,14 @@ Job 中每个 Pod 内的 “工作程序” 使用工作队列客户端库获取
|
|||
{{< codenew language="python" file="application/job/redis/worker.py" >}}
|
||||
|
||||
<!--
|
||||
You could download [`worker.py`](/examples/application/job/redis/worker.py), [`rediswq.py`](/examples/application/job/redis/rediswq.py), and [`Dockerfile`](/examples/application/job/redis/Dockerfile)
|
||||
using above links. Then build the image:
|
||||
You could also download [`worker.py`](/examples/application/job/redis/worker.py),
|
||||
[`rediswq.py`](/examples/application/job/redis/rediswq.py), and
|
||||
[`Dockerfile`](/examples/application/job/redis/Dockerfile) files, then build
|
||||
the image:
|
||||
-->
|
||||
你也可以下载 [`worker.py`](/examples/application/job/redis/worker.py)、
|
||||
[`rediswq.py`](/examples/application/job/redis/rediswq.py) 和
|
||||
[`Dockerfile`](/examples/application/job/redis/Dockerfile)。然后构建镜像:
|
||||
[`Dockerfile`](/examples/application/job/redis/Dockerfile) 文件。然后构建镜像:
|
||||
|
||||
```shell
|
||||
docker build -t job-wq-2 .
|
||||
|
@ -334,6 +336,7 @@ kubectl logs pods/job-wq-2-7r7b2
|
|||
```
|
||||
|
||||
日志类似于:
|
||||
|
||||
```
|
||||
Worker with sessionID: bbd72d0a-9e5c-4dd6-abf6-416cc267991f
|
||||
Initial queue state: empty=False
|
||||
|
@ -356,7 +359,8 @@ As you can see, one of our pods worked on several work units.
|
|||
|
||||
<!--
|
||||
If running a queue service or modifying your containers to use a work queue is inconvenient, you may
|
||||
want to consider one of the other [job patterns](/docs/concepts/jobs/run-to-completion-finite-workloads/#job-patterns).
|
||||
want to consider one of the other
|
||||
[job patterns](/docs/concepts/workloads/controllers/job/#job-patterns).
|
||||
-->
|
||||
如果你不方便运行一个队列服务或者修改你的容器用于运行一个工作队列,你可以考虑其它的
|
||||
[Job 模式](/zh-cn/docs/concepts/workloads/controllers/job/#job-patterns)。
|
||||
|
|
|
@ -31,7 +31,7 @@ Pod 具有控制平面自动设置的**索引编号(index number)**,
|
|||
The pod index is available in the {{< glossary_tooltip text="annotation" term_id="annotation" >}}
|
||||
`batch.kubernetes.io/job-completion-index` as a string representing its
|
||||
decimal value. In order for the containerized task process to obtain this index,
|
||||
you can publish the value of the annotation using the [downward API](/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api)
|
||||
you can publish the value of the annotation using the [downward API](/docs/concepts/workloads/pods/downward-api/)
|
||||
mechanism.
|
||||
For convenience, the control plane automatically sets the downward API to
|
||||
expose the index in the `JOB_COMPLETION_INDEX` environment variable.
|
||||
|
@ -39,7 +39,7 @@ expose the index in the `JOB_COMPLETION_INDEX` environment variable.
|
|||
Pod 索引在{{<glossary_tooltip text="注解" term_id="annotation" >}}
|
||||
`batch.kubernetes.io/job-completion-index` 中呈现,具体表示为一个十进制值字符串。
|
||||
为了让容器化的任务进程获得此索引,你可以使用
|
||||
[downward API](/zh-cn/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api)
|
||||
[downward API](/zh-cn/docs/concepts/workloads/pods/downward-api/)
|
||||
机制发布注解的值。为方便起见,
|
||||
控制平面自动设置 Downward API 以在 `JOB_COMPLETION_INDEX` 环境变量中公开索引。
|
||||
|
||||
|
@ -91,8 +91,8 @@ To access the work item from the worker program, you have a few options:
|
|||
1. 读取 `JOB_COMPLETION_INDEX` 环境变量。Job
|
||||
{{< glossary_tooltip text="控制器" term_id="controller" >}}
|
||||
自动将此变量链接到包含完成索引的注解。
|
||||
1. 读取包含完整索引的文件。
|
||||
1. 假设你无法修改程序,你可以使用脚本包装它,
|
||||
2. 读取包含完整索引的文件。
|
||||
3. 假设你无法修改程序,你可以使用脚本包装它,
|
||||
该脚本使用上述任意方法读取索引并将其转换为程序可以用作输入的内容。
|
||||
|
||||
<!--
|
||||
|
|
Loading…
Reference in New Issue