diff --git a/src/deadline_worker_agent/api_models.py b/src/deadline_worker_agent/api_models.py index 5ff7519e..9a4c072c 100644 --- a/src/deadline_worker_agent/api_models.py +++ b/src/deadline_worker_agent/api_models.py @@ -328,7 +328,7 @@ class Attachments(TypedDict): manifests: list[ManifestProperties] """A list of all manifests and their configuration""" - assetLoadingMethod: NotRequired[str] + fileSystem: NotRequired[str] """Method to use when loading assets required for a job""" diff --git a/src/deadline_worker_agent/boto/shim.py b/src/deadline_worker_agent/boto/shim.py index 7ba01826..7a28f232 100644 --- a/src/deadline_worker_agent/boto/shim.py +++ b/src/deadline_worker_agent/boto/shim.py @@ -280,7 +280,7 @@ def batch_get_job_entity( "jobId": "job-21432d89b44a46cbaaeb2f1d5254e548", "attachments": { "manifests": [], - "assetLoadingMethod": "PRELOAD", + "fileSystem": "COPIED", }, }, }, diff --git a/src/deadline_worker_agent/sessions/job_entities/job_attachment_details.py b/src/deadline_worker_agent/sessions/job_entities/job_attachment_details.py index 7b543c77..1bed2707 100644 --- a/src/deadline_worker_agent/sessions/job_entities/job_attachment_details.py +++ b/src/deadline_worker_agent/sessions/job_entities/job_attachment_details.py @@ -5,7 +5,7 @@ from typing import Any, cast from openjd.sessions import Parameter, ParameterType -from deadline.job_attachments.models import AssetLoadingMethod +from deadline.job_attachments.models import JobAttachmentsFileSystem from ...api_models import ( FloatParameter, @@ -84,7 +84,7 @@ class JobAttachmentDetails: Each item in the list specifies its path, required input assets, and output assets. """ - asset_loading_method: AssetLoadingMethod = AssetLoadingMethod.PRELOAD + job_attachments_file_system: JobAttachmentsFileSystem = JobAttachmentsFileSystem.COPIED """Method to use when loading assets required for a job""" @classmethod @@ -126,9 +126,9 @@ def from_boto( ) for manifest_properties in job_attachments_details_data["attachments"]["manifests"] ], - asset_loading_method=AssetLoadingMethod( + job_attachments_file_system=JobAttachmentsFileSystem( job_attachments_details_data["attachments"].get( - "assetLoadingMethod", AssetLoadingMethod.PRELOAD + "fileSystem", JobAttachmentsFileSystem.COPIED ) ), ) @@ -185,7 +185,7 @@ def validate_entity_data(cls, entity_data: dict[str, Any]) -> JobAttachmentDetai Field(key="inputManifestHash", expected_type=str, required=False), ), ), - Field(key="assetLoadingMethod", expected_type=str, required=False), + Field(key="fileSystem", expected_type=str, required=False), ), ), ), diff --git a/src/deadline_worker_agent/sessions/session.py b/src/deadline_worker_agent/sessions/session.py index 56742653..57f8a623 100644 --- a/src/deadline_worker_agent/sessions/session.py +++ b/src/deadline_worker_agent/sessions/session.py @@ -798,7 +798,7 @@ def progress_handler(job_upload_status: ProgressReportMetadata) -> bool: attachments = Attachments( manifests=manifest_properties_list, - assetLoadingMethod=self._job_attachment_details.asset_loading_method, + fileSystem=self._job_attachment_details.job_attachments_file_system, ) storage_profiles_path_mapping_rules_dict: dict[str, str] = { @@ -1064,7 +1064,7 @@ def _sync_asset_outputs( attachments = Attachments( manifests=manifest_properties_list, - assetLoadingMethod=job_attachment_details.asset_loading_method, + fileSystem=job_attachment_details.job_attachments_file_system, ) storage_profiles_path_mapping_rules_dict: dict[str, str] = { diff --git a/test/unit/conftest.py b/test/unit/conftest.py index 92f6f601..7ea3293e 100644 --- a/test/unit/conftest.py +++ b/test/unit/conftest.py @@ -10,7 +10,7 @@ from typing import Generator, Optional from deadline.job_attachments.models import ( - AssetLoadingMethod, + JobAttachmentsFileSystem, Attachments, ManifestProperties, OperatingSystemFamily, @@ -215,19 +215,19 @@ def job_attachment_manifest_properties( @pytest.fixture -def asset_loading_method() -> AssetLoadingMethod: - return AssetLoadingMethod.PRELOAD +def job_attachments_file_system() -> JobAttachmentsFileSystem: + return JobAttachmentsFileSystem.COPIED @pytest.fixture def job_attachment_details( job_attachment_manifest_properties: JobAttachmentManifestProperties, - asset_loading_method: AssetLoadingMethod, + job_attachments_file_system: JobAttachmentsFileSystem, ) -> JobAttachmentDetails | None: """Job attachment settings for the job""" return JobAttachmentDetails( manifests=[job_attachment_manifest_properties], - asset_loading_method=asset_loading_method, + job_attachments_file_system=job_attachments_file_system, ) diff --git a/test/unit/scheduler/test_session_queue.py b/test/unit/scheduler/test_session_queue.py index 7d920cde..55af7192 100644 --- a/test/unit/scheduler/test_session_queue.py +++ b/test/unit/scheduler/test_session_queue.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock, Mock, patch from collections import OrderedDict -from deadline.job_attachments.models import AssetLoadingMethod +from deadline.job_attachments.models import JobAttachmentsFileSystem from openjd.model import SchemaVersion, UnsupportedSchema from openjd.model.v2023_09 import ( Environment, @@ -170,7 +170,7 @@ class TestSessionActionQueueDequeue: SyncInputJobAttachmentsAction( id="id", job_attachment_details=JobAttachmentDetails( - asset_loading_method=AssetLoadingMethod.PRELOAD, + job_attachments_file_system=JobAttachmentsFileSystem.COPIED, manifests=[], ), ), diff --git a/test/unit/sessions/test_job_attachment_details.py b/test/unit/sessions/test_job_attachment_details.py index 3fdb024f..a0ec5036 100644 --- a/test/unit/sessions/test_job_attachment_details.py +++ b/test/unit/sessions/test_job_attachment_details.py @@ -2,11 +2,11 @@ import pytest -from deadline.job_attachments.models import AssetLoadingMethod +from deadline.job_attachments.models import JobAttachmentsFileSystem from deadline_worker_agent.sessions.job_entities.job_attachment_details import JobAttachmentDetails -@pytest.mark.parametrize("loading_method", [e.value for e in AssetLoadingMethod]) +@pytest.mark.parametrize("loading_method", [e.value for e in JobAttachmentsFileSystem]) def test_asset_loading_method(loading_method): """Test that the loading method is read from the boto data into JobAttachmentDetails""" entity_obj = JobAttachmentDetails.from_boto( @@ -14,13 +14,13 @@ def test_asset_loading_method(loading_method): "jobId": "myjob", "attachments": { "manifests": [], - "assetLoadingMethod": loading_method, + "fileSystem": loading_method, }, }, ) assert entity_obj is not None - assert entity_obj.asset_loading_method == loading_method + assert entity_obj.job_attachments_file_system == loading_method def test_asset_loading_method_default(): @@ -35,4 +35,4 @@ def test_asset_loading_method_default(): ) assert entity_obj is not None - assert entity_obj.asset_loading_method == AssetLoadingMethod.PRELOAD + assert entity_obj.job_attachments_file_system == JobAttachmentsFileSystem.COPIED diff --git a/test/unit/sessions/test_job_entities.py b/test/unit/sessions/test_job_entities.py index 04b37297..3a7b3d22 100644 --- a/test/unit/sessions/test_job_entities.py +++ b/test/unit/sessions/test_job_entities.py @@ -4,7 +4,7 @@ from typing import Generator from unittest.mock import MagicMock, patch -from deadline.job_attachments.models import AssetLoadingMethod +from deadline.job_attachments.models import JobAttachmentsFileSystem from openjd.model import SchemaVersion from openjd.model.v2023_09 import ( Action, @@ -357,9 +357,7 @@ def test_job_attachment_details(self, deadline_client: MagicMock, job_id: str): details_boto = JobAttachmentDetailsBoto( jobAttachmentDetails=JobAttachmentDetailsData( jobId=job_id, - attachments=Attachments( - manifests=[], assetLoadingMethod=AssetLoadingMethod.PRELOAD - ), + attachments=Attachments(manifests=[], fileSystem=JobAttachmentsFileSystem.COPIED), ) ) response: BatchGetJobEntityResponse = { @@ -367,7 +365,7 @@ def test_job_attachment_details(self, deadline_client: MagicMock, job_id: str): "errors": [], } expected_details = JobAttachmentDetails( - manifests=[], asset_loading_method=AssetLoadingMethod.PRELOAD + manifests=[], job_attachments_file_system=JobAttachmentsFileSystem.COPIED ) deadline_client.batch_get_job_entity.return_value = response job_entities = JobEntities( diff --git a/test/unit/sessions/test_session.py b/test/unit/sessions/test_session.py index e270ce6f..36920e20 100644 --- a/test/unit/sessions/test_session.py +++ b/test/unit/sessions/test_session.py @@ -45,7 +45,7 @@ ) from deadline.job_attachments.models import ( Attachments, - AssetLoadingMethod, + JobAttachmentsFileSystem, PosixFileSystemPermissionSettings, ) import deadline_worker_agent.sessions.session as session_mod @@ -482,17 +482,19 @@ def mock_asset_sync(self, session: Session) -> Generator[MagicMock, None, None]: with patch.object(session, "_asset_sync") as mock_asset_sync: yield mock_asset_sync - # This overrides the asset_loading_method fixture in tests/unit/conftest.py which feeds into + # This overrides the job_attachments_file_system fixture in tests/unit/conftest.py which feeds into # the job_attachment_details fixture - @pytest.mark.parametrize("asset_loading_method", [e.value for e in AssetLoadingMethod]) + @pytest.mark.parametrize( + "job_attachments_file_system", [e.value for e in JobAttachmentsFileSystem] + ) def test_asset_loading_method( self, session: Session, - asset_loading_method: AssetLoadingMethod, + job_attachments_file_system: JobAttachmentsFileSystem, mock_asset_sync: MagicMock, job_attachment_details: JobAttachmentDetails, ) -> None: - """Tests that the asset_loading_method specified in session._job_details is properly passed to the sync_inputs function""" + """Tests that the job_attachments_file_system specified in session._job_details is properly passed to the sync_inputs function""" # GIVEN mock_sync_inputs: MagicMock = mock_asset_sync.sync_inputs mock_sync_inputs.return_value = ({}, {}) @@ -511,7 +513,7 @@ def test_asset_loading_method( session_dir=ANY, attachments=Attachments( manifests=ANY, - assetLoadingMethod=asset_loading_method, + fileSystem=job_attachments_file_system, ), fs_permission_settings=PosixFileSystemPermissionSettings( os_group="some-group", @@ -531,7 +533,7 @@ def test_asset_loading_method( { "job_attachment_details": JobAttachmentDetails( manifests=[], - asset_loading_method="PRELOAD", + job_attachments_file_system="COPIED", ) } ], @@ -542,7 +544,7 @@ def test_asset_loading_method( { "job_attachment_details": JobAttachmentDetails( manifests=[], - asset_loading_method="PRELOAD", + job_attachments_file_system="COPIED", ) }, {"step_dependencies": ["step-1"]}, @@ -619,7 +621,7 @@ def test_job_attachments_path_mapping_rules_compatibility( sync_asset_inputs_args = { "job_attachment_details": JobAttachmentDetails( manifests=[], - asset_loading_method=AssetLoadingMethod.PRELOAD, + job_attachments_file_system=JobAttachmentsFileSystem.COPIED, ) }