Skip to content

Commit

Permalink
fix unit test mock
Browse files Browse the repository at this point in the history
Signed-off-by: Godot Bian <[email protected]>
  • Loading branch information
godobyte committed Dec 5, 2024
1 parent b6d9839 commit 99d5b6f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/deadline_worker_agent/scheduler/session_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def insert_front(
*,
action: AttachmentUploadActionApiModel,
) -> None:
"""Inserts an attachmen upload action at the front of the queue
"""Inserts an attachment upload action at the front of the queue
Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
from deadline.job_attachments.models import ManifestSnapshot

"""
A small script to upload job output using attachment upload.
This is available in deadline-cloud as python API and AWS Deadline Cloud CLI.
A small script to
1. capture the difference since the given base input manifest to generate manifests via manifest snapshot
2. upload job output based on the diff manifests using attachment upload
The manifest snapshot and attachment upload commands are available in deadline-cloud as python API and AWS Deadline Cloud CLI.
Example usage:
Expand All @@ -41,12 +44,15 @@ def snapshot(manifest_paths_by_root: dict[str, str]) -> list[str]:
manifests = list()

for root, path in manifest_paths_by_root.items():
# TODO - use the public api for manifest snapshot once that's final and made public
manifest: Optional[ManifestSnapshot] = _manifest_snapshot(
root=root,
# direcotry to put the generated diff manifests
destination=str(output_path),
# `output` is used for job download to discover output manifests
# manifest file name need to contain the hash of root path for attachment CLI path mapping
name=f"output-{os.path.basename(path)}",
# this path to manifest servers as a base for the snapshot, generate only difference since this manifest
diff=path,
)
if manifest:
Expand Down
2 changes: 2 additions & 0 deletions test/unit/sessions/actions/test_run_attachment_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class TestStart:
def session(
self,
session_id: str,
session_dir: str,
job_details: JobDetails,
job_user: SessionUser,
job_attachment_details: JobAttachmentDetails,
Expand All @@ -102,6 +103,7 @@ def session(
session._job_attachment_details = job_attachment_details
session._os_user = job_user
session.openjd_session = mock_openjd_session_cls
session.working_directory = session_dir
session._queue_id = TestStart.QUEUE_ID
session._queue._job_id = TestStart.JOB_ID
return session
Expand Down
4 changes: 2 additions & 2 deletions test/unit/sessions/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ def mock_now(*arg, **kwarg) -> datetime:

@pytest.mark.skipif(
ASSET_SYNC_JOB_USER_FEATURE,
reason="This test will be removed after releasing the asset sync job user feature",
reason="This test will be re-written before releasing the asset sync job user feature",
)
def test_success_task_run_fail_output_sync(
self,
Expand Down Expand Up @@ -1675,7 +1675,7 @@ def mock_now(*arg, **kwarg) -> datetime:

@pytest.mark.skipif(
ASSET_SYNC_JOB_USER_FEATURE,
reason="This test will be removed after releasing the asset sync job user feature",
reason="This test will be re-written before releasing the asset sync job user feature",
)
def test_logs_succeeded(
self,
Expand Down

0 comments on commit 99d5b6f

Please sign in to comment.