

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在截止日期雲端上將影格分組為具有任務區塊的區塊
<a name="examples-jb-task-chunking"></a>

[task\_chunking](https://github.com/aws-deadline/deadline-cloud-samples/tree/mainline/job_bundles/task_chunking) 範例示範開放任務描述[的任務區塊化](https://github.com/OpenJobDescription/openjd-specifications/blob/mainline/rfcs/0001-task-chunking.md)延伸。在轉譯每個影格之前，轉譯任務通常會花費大量時間載入應用程式和場景檔案。區塊會透過處理每個區塊的多個影格來攤銷此額外負荷，從而減少總任務執行時間。

這些範例包含四個範例：

basic\_contiguous\_chunks  
使用 的最小範例`rangeConstraint: CONTIGUOUS`。每個區塊都會擴展到 `"1-10"`或 等範圍`"11-20"`。

basic\_non\_contiguous\_chunks  
使用 的最小範例`rangeConstraint: NONCONTIGUOUS`。區塊可以是任意影格集，例如 `"1-3,5,7-20:2"`。

blender\_render\_with\_contiguous\_chunks  
實際範例從[在截止日期雲端上轉譯 Blender 場景](examples-jb-blender-render.md)套件轉換為使用連續區塊轉譯。

blender\_render\_with\_non\_contiguous\_chunks  
具有非連續區塊的 Blender 變體。

根據應用程式選擇範圍限制條件：
+ `CONTIGUOUS` — 當應用程式支援開始和結束影格引數時，請使用 。
+ `NONCONTIGUOUS` — 當應用程式支援任意影格清單時使用。

若要在範本中啟用任務區塊，請新增 `extensions: [TASK_CHUNKING]`、定義 類型的參數`CHUNK[INT]`，並設定 `defaultTaskCount`、 `targetRuntimeSeconds`和 `rangeConstraint`：

```
specificationVersion: 'jobtemplate-2023-09'
extensions:
  - TASK_CHUNKING
steps:
  - name: Render
    parameterSpace:
      taskParameterDefinitions:
        - name: Frame
          type: CHUNK[INT]
          range: "{{Param.Frames}}"
          chunks:
            defaultTaskCount: 10
            targetRuntimeSeconds: 600
            rangeConstraint: CONTIGUOUS
```