Skip to content

Commit

Permalink
chore: upgrade deadline-cloud version to 0.34.* (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Gahyun Suh <[email protected]>
  • Loading branch information
gahyusuh authored Nov 17, 2023
1 parent 5165a4d commit 50cda95
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
dependencies = [
"requests ~= 2.31",
"boto3 >= 1.28.80",
"deadline == 0.32.*",
"deadline == 0.34.*",
"openjd-sessions == 0.2.*",
# tomli became tomllib in standard library in Python 3.11
"tomli == 2.0.* ; python_version<'3.11'",
Expand Down
2 changes: 1 addition & 1 deletion src/deadline_worker_agent/api_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class JobDetailsError(TypedDict):

class JobAttachmentQueueSettings(TypedDict):
"""
Containts the configuration of job attachments for a Amazon Deadline Cloud queue. This includes the name of
Contains the configuration of job attachments for a Amazon Deadline Cloud queue. This includes the name of
the S3 bucket as well as the object key structure. The structure of the objects with respect to
this structure's fields is illustrated below:
Expand Down
14 changes: 9 additions & 5 deletions src/deadline_worker_agent/sessions/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@
from deadline.job_attachments.asset_sync import logger as ASSET_SYNC_LOGGER
from deadline.job_attachments.models import (
Attachments,
PosixFileSystemPermissionSettings,
JobAttachmentS3Settings,
ManifestProperties,
PathFormat,
)
from deadline.job_attachments.progress_tracker import ProgressReportMetadata
from deadline.job_attachments.os_file_permission import (
FileSystemPermissionSettings,
PosixFileSystemPermissionSettings,
)

from ..scheduler.session_action_status import SessionActionStatus
from ..sessions.errors import SessionActionError
Expand Down Expand Up @@ -406,7 +409,7 @@ def _replace_assigned_actions_impl(
Session.replace_assigned_actions() is a thin wrapper of
Session._replace_assigned_actions_impl that acquires Session._current_action_lock
before/after calling this method. The separation exists to more easily test the locking
semantics indepdently from the business logic.
semantics independently from the business logic.
"""
running_action_id: str | None = None
if running_action := self._current_action:
Expand Down Expand Up @@ -719,7 +722,7 @@ def exit_environment(
if not self._active_envs or self._active_envs[-1].job_env_id != job_env_id:
env_stack_str = ", ".join(env.job_env_id for env in self._active_envs)
raise ValueError(
f"Specified enviornment ({job_env_id}) is not the inner-most active environment."
f"Specified environment ({job_env_id}) is not the inner-most active environment."
f"Active environments from outer-most to inner-most are: {env_stack_str}"
)
active_env = self._active_envs[-1]
Expand Down Expand Up @@ -819,12 +822,13 @@ def progress_handler(job_upload_status: ProgressReportMetadata) -> bool:
for rule in self._job_details.path_mapping_rules
}

fs_permission_settings = None
fs_permission_settings: Optional[FileSystemPermissionSettings] = None
if self._os_user is not None:
if os.name == "posix":
if not isinstance(self._os_user, PosixSessionUser):
raise ValueError(f"The user must be a posix-user. Got {type(self._os_user)}")
fs_permission_settings = PosixFileSystemPermissionSettings(
os_user=self._os_user.user,
os_group=self._os_user.group,
dir_mode=0o20,
file_mode=0o20,
Expand Down Expand Up @@ -959,7 +963,7 @@ def _action_updated_impl(
# Synchronizing job output attachments is currently bundled together with the
# RunStepTaskAction. The synchronization happens after the task run succeeds, and both
# must be successful in order to mark the action as SUCCEEDED. The time when
# the action is completed should be the moment when the sunchronization have
# the action is completed should be the moment when the synchronization have
# been finished.
try:
self._sync_asset_outputs(current_action=current_action)
Expand Down
26 changes: 14 additions & 12 deletions test/unit/sessions/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
from deadline.job_attachments.models import (
Attachments,
JobAttachmentsFileSystem,
PosixFileSystemPermissionSettings,
)
from deadline.job_attachments.os_file_permission import PosixFileSystemPermissionSettings

import deadline_worker_agent.sessions.session as session_mod


Expand Down Expand Up @@ -264,7 +265,7 @@ def canceled_action_status(request: pytest.FixtureRequest) -> ActionStatus:
"no-status-msg",
),
)
def succeess_action_status(request: pytest.FixtureRequest) -> ActionStatus:
def success_action_status(request: pytest.FixtureRequest) -> ActionStatus:
"""A fixture providing a successful Open Job Description ActionStatus"""
return request.param

Expand Down Expand Up @@ -545,6 +546,7 @@ def test_asset_loading_method(
fileSystem=job_attachments_file_system,
),
fs_permission_settings=PosixFileSystemPermissionSettings(
os_user="some-user",
os_group="some-group",
dir_mode=0o20,
file_mode=0o20,
Expand Down Expand Up @@ -712,7 +714,7 @@ def action_update_lock_exit_side_effect(
class TestSessionCancelActions:
"""Test cases for Session.cancel_actions()"""

def test_locking_sematics(
def test_locking_semantics(
self,
session: Session,
) -> None:
Expand Down Expand Up @@ -868,7 +870,7 @@ def test_locking_semantics(
# We don't use the value of this fixture, but requiring it has the side-effect of assigning
# it as the current action of the session
current_action: CurrentAction,
succeess_action_status: ActionStatus,
success_action_status: ActionStatus,
) -> None:
"""Test that asserts that the _current_action_lock is entered before the method calls
Session._action_updated_impl() and that _current_action_lock is exited afterwards."""
Expand Down Expand Up @@ -898,7 +900,7 @@ def mock_action_updated_impl_side_effect(
mock_action_updated_impl.side_effect = mock_action_updated_impl_side_effect

# WHEN
session.update_action(succeess_action_status)
session.update_action(success_action_status)

# THEN
mock_action_updated_impl.assert_called_once()
Expand Down Expand Up @@ -1052,7 +1054,7 @@ def test_success_task_run(
action_start_time: datetime,
action_complete_time: datetime,
step_id: str,
succeess_action_status: ActionStatus,
success_action_status: ActionStatus,
task_id: str,
mock_report_action_update: MagicMock,
) -> None:
Expand Down Expand Up @@ -1082,7 +1084,7 @@ def test_success_task_run(
queue_cancel_all: MagicMock = session_action_queue.cancel_all
expected_action_update = SessionActionStatus(
id=action_id,
status=succeess_action_status,
status=success_action_status,
start_time=action_start_time,
completed_status="SUCCEEDED",
end_time=action_complete_time,
Expand All @@ -1105,7 +1107,7 @@ def sync_asset_outputs_side_effect(*, current_action: CurrentAction) -> None:

# WHEN
session._action_updated_impl(
action_status=succeess_action_status,
action_status=success_action_status,
now=action_complete_time,
)

Expand All @@ -1123,7 +1125,7 @@ def test_success_task_run_fail_output_sync(
action_start_time: datetime,
action_complete_time: datetime,
step_id: str,
succeess_action_status: ActionStatus,
success_action_status: ActionStatus,
task_id: str,
mock_report_action_update: MagicMock,
) -> None:
Expand Down Expand Up @@ -1171,7 +1173,7 @@ def test_success_task_run_fail_output_sync(
) as mock_sync_asset_outputs:
# WHEN
session._action_updated_impl(
action_status=succeess_action_status,
action_status=success_action_status,
now=action_complete_time,
)

Expand All @@ -1191,12 +1193,12 @@ def test_logs_succeeded(
current_action: CurrentAction,
mock_mod_logger: MagicMock,
session: Session,
succeess_action_status: ActionStatus,
success_action_status: ActionStatus,
) -> None:
"""Tests that succeeded actions are logged"""
# WHEN
session._action_updated_impl(
action_status=succeess_action_status,
action_status=success_action_status,
now=action_complete_time,
)

Expand Down

0 comments on commit 50cda95

Please sign in to comment.