Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/deadline_worker_agent/aws/deadline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from deadline.client.api import TelemetryClient
from deadline.client import version as deadline_client_lib_version
from deadline.job_attachments.progress_tracker import SummaryStatistics
from deadline.job_attachments.upload import SummaryStatistics
from openjd.model import version as openjd_model_version
from openjd.sessions import version as openjd_sessions_version

Expand Down Expand Up @@ -984,3 +984,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
return cast(F, wrapper)

return inner


def hash_summary_telemetry_callback(hash_summary: SummaryStatistics):
_get_deadline_telemetry_client().record_hashing_summary(hash_summary)
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
record_attachment_upload_latencies_telemetry_event,
record_attachment_upload_telemetry_event,
record_success_fail_telemetry_event,
hash_summary_telemetry_callback,
)
from deadline_worker_agent.sessions.attachment_models import (
WorkerManifestProperties,
Expand Down Expand Up @@ -180,6 +181,8 @@ def snapshot(
# when the code reaches here, it's guaranteed output_relative_directories contains value
include=[glob.escape(subdir) + "/**" for subdir in output_relative_directories],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)

if output_manifest:
Expand Down
12 changes: 12 additions & 0 deletions test/unit/sessions/actions/scripts/test_attachment_upload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from deadline_worker_agent.aws.deadline import hash_summary_telemetry_callback

import json
import pytest
Expand All @@ -7,6 +8,7 @@
from typing import Optional, Generator

import deadline_worker_agent.sessions.actions.scripts.attachment_upload as attachment_upload_mod
from deadline.client.config import config_file
from deadline.job_attachments.asset_manifests.decode import decode_manifest
from deadline.job_attachments.progress_tracker import ProgressStatus, ProgressTracker
from deadline.job_attachments.models import JobAttachmentS3Settings
Expand Down Expand Up @@ -212,13 +214,17 @@ def test_snapshot_mixed_output_directories(self, mock_manifest_snapshot: Mock):
diff="/base/manifest.json",
include=["output/**"],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)
mock_manifest_snapshot.assert_any_call(
root="/local/path4",
destination="manifest_snapshot",
diff=None,
include=["./**"],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)

@patch("deadline_worker_agent.sessions.actions.scripts.attachment_upload._manifest_snapshot")
Expand Down Expand Up @@ -255,13 +261,17 @@ def test_snapshot(self, mock_manifest_snapshot: Mock):
diff="/base/manifest.json",
include=["output/**"],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)
mock_manifest_snapshot.assert_any_call(
root="/local/path2",
destination="manifest_snapshot",
diff=None,
include=["output/**"],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)

@patch("deadline_worker_agent.sessions.actions.scripts.attachment_upload._manifest_snapshot")
Expand Down Expand Up @@ -299,6 +309,8 @@ def test_snapshot_with_special_characters_in_directory_names(
"[[]data_][*]dir2[?]/**", # Complex case with multiple special chars
],
name="output",
hash_cache_dir=config_file.get_cache_directory(),
telemetry_callback=hash_summary_telemetry_callback,
)

@patch.dict(
Expand Down
Loading