Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove optionally using operating system in the manifest file name hash #552

Merged
merged 3 commits into from
Jan 24, 2025
Merged
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
5 changes: 2 additions & 3 deletions src/deadline/job_attachments/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,15 @@ def _gather_upload_metadata(
manifest: BaseAssetManifest,
source_root: Path,
manifest_name_suffix: str,
# TODO - remove file_system_location_name after ASSET_SYNC_JOB_USER_FEATURE completion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a tracking ticket so we don't forget?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do, it's linked in the design doc.

file_system_location_name: Optional[str] = None,
) -> tuple[HashAlgorithm, bytes, str]:
"""
Gathers metadata information of manifest to be used for writing the local manifest
"""
hash_alg = manifest.get_default_hash_alg()
manifest_bytes = manifest.encode().encode("utf-8")
manifest_name_prefix = hash_data(
f"{file_system_location_name or ''}{str(source_root)}".encode(), hash_alg
)
manifest_name_prefix = hash_data(str(source_root).encode(), hash_alg)
manifest_name = f"{manifest_name_prefix}_{manifest_name_suffix}"

return (hash_alg, manifest_bytes, manifest_name)
Expand Down
22 changes: 22 additions & 0 deletions test/unit/deadline_job_attachments/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
PathFormat,
StorageProfile,
)
from deadline.job_attachments.asset_manifests.v2023_03_03 import AssetManifest

from deadline.job_attachments.progress_tracker import (
ProgressStatus,
SummaryStatistics,
Expand Down Expand Up @@ -2640,6 +2642,26 @@ def test_upload_object_to_cas_adds_cache_entry(
expected_files={"prefix/test-hash.xxh128"},
)

def test_gather_upload_metadata(self):
# Given
manifest = AssetManifest(
hash_alg=HashAlgorithm("xxh128"),
total_size=10,
paths=[
BaseManifestPath(path="output_file", hash="a", size=1, mtime=167907934333848),
BaseManifestPath(
path="output/nested_output_file", hash="b", size=1, mtime=1479079344833848
),
],
)
# When
(hash_alg, _, manifest_name) = S3AssetUploader._gather_upload_metadata(
manifest, Path("mocksourcerootpath"), "suffix"
)
# Then
assert hash_alg == HashAlgorithm.XXH128
assert manifest_name == "73addc7c69ddec53bd8d9df653add3c4_suffix"


def assert_progress_report_last_callback(
num_input_files: int,
Expand Down
Loading