

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 작업 번들에 대한 작업 템플릿 요소
<a name="build-job-bundle-template"></a>

작업 템플릿은 런타임 환경과 Deadline Cloud 작업의 일부로 실행되는 프로세스를 정의합니다. 템플릿에서 파라미터를 생성하여 프로그래밍 언어의 함수와 마찬가지로 입력 값만 다른 작업을 생성하는 데 사용할 수 있습니다.

Deadline Cloud에 작업을 제출하면 대기열에 적용된 모든 대기열 환경에서 실행됩니다. 대기열 환경은 Open Job Description(OpenJD) 외부 환경 사양을 사용하여 빌드됩니다. 자세한 내용은 OpenJD GitHub 리포지토리의 [환경 템플릿을](https://github.com/OpenJobDescription/openjd-specifications/wiki/2023-09-Template-Schemas#12-environment-template) 참조하세요.

OpenJD 작업 템플릿을 사용하여 작업을 생성하는 방법에 대한 소개는 OpenJD GitHub 리포지토리에서 [작업 생성 소개를](https://github.com/OpenJobDescription/openjd-specifications/wiki/Introduction-to-Creating-a-Job) 참조하세요. 추가 정보는 [작업 실행 방법에서 확인할 수 있습니다](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run). OpenJD GitHub 리포지토리의 `samples` 디렉터리에 있는에 작업 템플릿 샘플이 있습니다.

작업 템플릿을 YAML 형식(`template.yaml`) 또는 JSON 형식()으로 정의할 수 있습니다`template.json`. 이 섹션의 예제는 YAML 형식으로 표시됩니다.

예를 들어 `blender_render` 샘플의 작업 템플릿은 입력 파라미터를 파일 경로`BlenderSceneFile`로 정의합니다.

```
- name: BlenderSceneFile
  type: PATH
  objectType: FILE
  dataFlow: IN
  userInterface:
    control: CHOOSE_INPUT_FILE
    label: Blender Scene File
    groupLabel: Render Parameters
    fileFilters:
    - label: Blender Scene Files
      patterns: ["*.blend"]
    - label: All Files
      patterns: ["*"]
  description: >
    Choose the Blender scene file to render. Use the 'Job Attachments' tab
    to add textures and other files that the job needs.
```

`userInterface` 속성은 명령을 사용하고 Autodesk Maya와 같은 애플리케이션의 작업 제출 플러그인 내에서 `deadline bundle gui-submit` 명령줄 모두에 대해 자동으로 생성된 사용자 인터페이스의 동작을 정의합니다.

이 예제에서 `BlenderSceneFile` 파라미터 값을 입력하기 위한 UI 위젯은 파일만 표시하는 `.blend` 파일 선택 대화 상자입니다.

![OpenJD 작업 템플릿의 장면 파일 파라미터를 입력하기 위한 사용자 인터페이스 위젯입니다.](http://docs.aws.amazon.com/ko_kr/deadline-cloud/latest/developerguide/images/blender_submit_scene_file_widget.png)


`userInteface` 요소 사용에 대한 자세한 예는 GitHub의 deadline-cloud-samples 리포지토리에서 [gui\_control\_showcase](https://github.com/aws-deadline/deadline-cloud-samples/tree/mainline/job_bundles/gui_control_showcase) 샘플을 참조하세요. [deadline-cloud-samples](https://github.com/aws-deadline/deadline-cloud-samples/tree/mainline) 

`objectType` 및 `dataFlow` 속성은 작업 번들에서 작업을 제출할 때 작업 첨부 파일의 동작을 제어합니다. 이 경우 `objectType: FILE` 및 `BlenderSceneFile`는의 값이 작업 첨부 파일의 입력 파일임을 `dataFlow:IN` 의미합니다.

반대로 `OutputDir` 파라미터의 정의에는 `objectType: DIRECTORY` 및가 `dataFlow: OUT`있습니다.

```
- name: OutputDir
  type: PATH
  objectType: DIRECTORY
  dataFlow: OUT
  userInterface:
    control: CHOOSE_DIRECTORY
    label: Output Directory
    groupLabel: Render Parameters
  default: "./output"
  description: Choose the render output directory.
```

`OutputDir` 파라미터 값은 작업 첨부 파일에서 작업이 출력 파일을 쓰는 디렉터리로 사용됩니다.

`objectType` 및 `dataFlow` 속성에 대한 자세한 내용은 [Open](https://github.com/OpenJobDescription/openjd-specifications) Job Description 사양의 [JobPathParameterDefinition](https://github.com/OpenJobDescription/openjd-specifications/wiki/2023-09-Template-Schemas#22-jobpathparameterdefinition)을 참조하세요.

나머지 `blender_render` 작업 템플릿 샘플은 작업의 워크플로를 애니메이션의 각 프레임이 별도의 작업으로 렌더링되는 단일 단계로 정의합니다.

```
steps:
- name: RenderBlender
  parameterSpace:
    taskParameterDefinitions:
    - name: Frame
      type: INT
      range: "{{Param.Frames}}"
  script:
    actions:
      onRun:
        command: bash
        # Note: {{Task.File.Run}} is a variable that expands to the filename on the worker host's
        # disk where the contents of the 'Run' embedded file, below, is written.
        args: ['{{Task.File.Run}}']
    embeddedFiles:
      - name: Run
        type: TEXT
        data: |
          # Configure the task to fail if any individual command fails.
          set -xeuo pipefail

          mkdir -p '{{Param.OutputDir}}'

          blender --background '{{Param.BlenderSceneFile}}' \
                  --render-output '{{Param.OutputDir}}/{{Param.OutputPattern}}' \
                  --render-format {{Param.Format}} \
                  --use-extension 1 \
                  --render-frame {{Task.Param.Frame}}
```

예를 들어 `Frames` 파라미터 값이 인 경우 `1-10`10개의 작업을 정의합니다. 각 에는 `Frame` 파라미터 값이 다릅니다. 작업을 실행하려면:

1. 와 같이 임베디드 파일의 `data` 속성에 있는 모든 변수 참조가 확장됩니다`--render-frame 1`.

1. `data` 속성의 내용은 디스크의 세션 작업 디렉터리에 있는 파일에 기록됩니다.

1. 작업의 `onRun` 명령이 로 확인`bash {{location of embedded file}}`되고 실행됩니다.

임베디드 파일, 세션 및 경로 매핑 위치에 대한 자세한 내용은 [Open Job Description 사양](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run)의 [작업 실행 방법을](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run) 참조하세요.

[deadline-cloud-samples/job\_bundles](https://github.com/aws-deadline/deadline-cloud-samples/tree/mainline/job_bundles) 리포지토리에는 작업 템플릿의 더 많은 예와 Open Job Descriptions 사양과 함께 제공되는 [템플릿 샘플](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/samples)이 있습니다.