

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

# 작업에서 출력 파일 가져오기
<a name="getting-output-files-from-a-job"></a>

이 예제는 Deadline Cloud가 작업이 생성하는 출력 파일을 식별하는 방법, Amazon S3에 해당 파일을 업로드할지 여부, 워크스테이션에서 해당 출력 파일을 가져올 수 있는 방법을 보여줍니다.

 이 예제에서는 `job_attachments_devguide_output` 작업 번들 대신 `job_attachments_devguide` 작업 번들을 사용합니다. 먼저 Deadline Cloud 샘플 GitHub 리포지토리의 복제본에서 AWS CloudShell 환경의 번들 사본을 만듭니다.

```
cp -r deadline-cloud-samples/job_bundles/job_attachments_devguide_output ~/
```

 이 작업 번들과 `job_attachments_devguide` 작업 번들의 중요한 차이점은 작업 템플릿에 새 작업 파라미터를 추가하는 것입니다.

```
...
parameterDefinitions:
...
- name: OutputDir
  type: PATH
  objectType: DIRECTORY
  dataFlow: OUT
  default: ./output_dir
  description: This directory contains the output for all steps.
...
```

 파라미터의 `dataFlow` 속성에는 값이 있습니다`OUT`. Deadline Cloud는 `OUT` 또는 값이 있는 `dataFlow` 작업 파라미터의 값을 작업의 출력`INOUT`으로 사용합니다. 이러한 종류의 작업 파라미터에 값으로 전달된 파일 시스템 위치가 작업을 실행하는 작업자의 로컬 파일 시스템 위치로 다시 매핑되는 경우 Deadline Cloud는 해당 위치에서 새 파일을 찾아 작업 출력으로 Amazon S3에 업로드합니다.

 이 프로세스의 작동 방식을 확인하려면 먼저 AWS CloudShell 탭에서 Deadline Cloud 작업자 에이전트를 시작합니다. 이전에 제출한 작업의 실행을 완료합니다. 그런 다음 로그 디렉터리에서 작업 로그를 삭제합니다.

```
rm -rf ~/demoenv-logs/queue-*
```

 그런 다음이 작업 번들을 사용하여 작업을 제출합니다. CloudShell에서 실행 중인 작업자를 실행한 후 로그를 확인합니다.

```
# Change the value of FARM_ID to your farm's identifier
FARM_ID=farm-{{00112233445566778899aabbccddeeff}}
# Change the value of QUEUE1_ID to queue Q1's identifier
QUEUE1_ID=queue-{{00112233445566778899aabbccddeeff}}
# Change the value of WSALL_ID to the identifier of the WSAll storage profile
WSALL_ID=sp-{{00112233445566778899aabbccddeeff}}

deadline config set settings.storage_profile_id $WSALL_ID

deadline bundle submit --farm-id $FARM_ID --queue-id $QUEUE1_ID ./job_attachments_devguide_output
```

 로그는 파일이 출력으로 감지되어 Amazon S3에 업로드되었음을 보여줍니다.

```
2024-07-17 02:13:10,873 INFO ----------------------------------------------
2024-07-17 02:13:10,873 INFO Uploading output files to Job Attachments
2024-07-17 02:13:10,873 INFO ----------------------------------------------
2024-07-17 02:13:10,873 INFO Started syncing outputs using Job Attachments
2024-07-17 02:13:10,955 INFO Found 1 file totaling 117.0 B in output directory: /sessions/session-7efa/assetroot-{{3751a}}/output_dir
2024-07-17 02:13:10,956 INFO Uploading output manifest to DeadlineCloud/Manifests/farm-0011/queue-2233/job-4455/step-6677/task-6677-0/2024-07-17T02:13:10.835545Z_sessionaction-8899-1/c6808439dfc59f86763aff5b07b9a76c_output
2024-07-17 02:13:10,988 INFO Uploading 1 output file to S3: {{s3BucketName}}/DeadlineCloud/Data
2024-07-17 02:13:11,011 INFO Uploaded 117.0 B / 117.0 B of 1 file (Transfer rate: 0.0 B/s)
2024-07-17 02:13:11,011 INFO Summary Statistics for file uploads:
Processed 1 file totaling 117.0 B.
Skipped re-processing 0 files totaling 0.0 B.
Total processing time of 0.02281 seconds at 5.13 KB/s.
```

 또한 로그는 Deadline Cloud가 대기열의 작업 첨부 파일에서 사용하도록 구성된 Amazon S3 버킷에 새 매니페스트 객체를 생성했음을 보여줍니다`Q1`. 매니페스트 객체의 이름은 출력을 생성한 작업의 팜, 대기열, 작업, 단계, 작업, 타임스탬프 및 `sessionaction` 식별자에서 파생됩니다. 이 매니페스트 파일을 다운로드하여 Deadline Cloud가이 작업에 대한 출력 파일을 배치한 위치를 확인합니다.

```
# The name of queue `Q1`'s job attachments S3 bucket
Q1_S3_BUCKET=$(
  aws deadline get-queue --farm-id $FARM_ID --queue-id $QUEUE1_ID \
    --query 'jobAttachmentSettings.s3BucketName' | tr -d '"'
)

# Fill this in with the object name from your log
OBJECT_KEY="{{DeadlineCloud/Manifests/...}}"

aws s3 cp --quiet s3://$Q1_S3_BUCKET/$OBJECT_KEY /dev/stdout | jq .
```

 매니페스트는 다음과 같습니다.

```
{
  "hashAlg": "xxh128",
  "manifestVersion": "2023-03-03",
  "paths": [
    {
      "hash": "34178940e1ef9956db8ea7f7c97ed842",
      "mtime": 1721182390859777,
      "path": "output_dir/output.txt",
      "size": 117
    }
  ],
  "totalSize": 117
}
```

 이는 작업 입력 파일이 저장되는 것과 동일한 방식으로 출력 파일의 콘텐츠가 Amazon S3에 저장됨을 보여줍니다. 입력 파일과 마찬가지로 출력 파일은 파일의 해시와 접두사가 포함된 객체 이름과 함께 S3에 저장됩니다`DeadlineCloud/Data`.

```
$ aws s3 ls --recursive s3://$Q1_S3_BUCKET | grep 34178940e1ef9956db8ea7f7c97ed842
2024-07-17 02:13:11        117 DeadlineCloud/Data/34178940e1ef9956db8ea7f7c97ed842.xxh128
```

 Deadline Cloud 모니터 또는 Deadline Cloud CLI를 사용하여 워크스테이션에 작업 출력을 다운로드할 수 있습니다.

```
deadline job download-output --farm-id $FARM_ID --queue-id $QUEUE1_ID --job-id $JOB_ID
```

 제출된 `OutputDir` 작업의 작업 파라미터 값은 `./output_dir`이므로 출력은 작업 번들 디렉터리 `output_dir` 내에서 라는 디렉터리에 다운로드됩니다. 절대 경로 또는 다른 상대 위치를의 값으로 지정한 경우 `OutputDir`출력 파일이 대신 해당 위치로 다운로드됩니다.

```
$ deadline job download-output --farm-id $FARM_ID --queue-id $QUEUE1_ID --job-id $JOB_ID
Downloading output from Job 'Job Attachments Explorer: Output'

Summary of files to download:
    /home/cloudshell-user/job_attachments_devguide_output/output_dir/output.txt (1 file)

You are about to download files which may come from multiple root directories. Here are a list of the current root directories:
[0] /home/cloudshell-user/job_attachments_devguide_output
> Please enter the index of root directory to edit, y to proceed without changes, or n to cancel the download (0, y, n) [y]: 

Downloading Outputs  [####################################]  100%
Download Summary:
    Downloaded 1 files totaling 117.0 B.
    Total download time of 0.14189 seconds at 824.0 B/s.
    Download locations (total file counts):
        /home/cloudshell-user/job_attachments_devguide_output (1 file)
```