From c8af5ddd1ca0d89303c0102827ee7e1d27c4c933 Mon Sep 17 00:00:00 2001 From: Josh Usiskin <56369778+jusiskin@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:43:25 +0000 Subject: [PATCH] feat: configurable worker session root directory Signed-off-by: Josh Usiskin <56369778+jusiskin@users.noreply.github.com> --- src/deadline_test_fixtures/deadline/worker.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/deadline_test_fixtures/deadline/worker.py b/src/deadline_test_fixtures/deadline/worker.py index 365eb91..b256ba5 100644 --- a/src/deadline_test_fixtures/deadline/worker.py +++ b/src/deadline_test_fixtures/deadline/worker.py @@ -95,22 +95,26 @@ class DeadlineWorkerConfiguration: no_local_session_logs: str | None = None disallow_instance_profile: str | None = None - """Mapping of files to copy from host environment to worker environment""" file_mappings: list[tuple[str, str]] | None = None + """Mapping of files to copy from host environment to worker environment""" - """Commands to run before installing the Worker agent""" pre_install_commands: list[str] | None = None + """Commands to run before installing the Worker agent""" job_user: str = field(default="job-user") agent_user: str = field(default="deadline-worker") job_user_group: str = field(default="deadline-job-users") - """Additional job users to configure for Posix workers""" job_users: list[PosixSessionUser] = field( default_factory=lambda: [PosixSessionUser("job-user", "job-user")] ) - """Additional job users to configure for Windows workers""" + """Additional job users to configure for Posix workers""" + windows_job_users: list = field(default_factory=lambda: ["job-user"]) + """Additional job users to configure for Windows workers""" + + session_root_dir: str | None = None + """Path to parent directory of worker session directories""" @dataclass @@ -548,6 +552,7 @@ def configure_worker_command(self, *, config: DeadlineWorkerConfiguration) -> st + f"--user {config.agent_user} " + f"{'--allow-shutdown ' if config.allow_shutdown else ''}" + f"{'--disallow-instance-profile ' if config.disallow_instance_profile else ''}" + + (f"--session-root-dir {config.session_root_dir} " if config.session_root_dir is not None else '') ), # fmt: on ] @@ -772,6 +777,7 @@ def configure_worker_command( + f"{'--allow-shutdown ' if config.allow_shutdown else ''}" + f"{'--no-install-service ' if config.no_install_service else ''}" + f"{'--disallow-instance-profile ' if config.disallow_instance_profile else ''}" + + (f"--session-root-dir {config.session_root_dir} " if config.session_root_dir is not None else '') ), # fmt: on f"runuser --login {self.configuration.agent_user} --command 'echo \"source /opt/deadline/worker/bin/activate\" >> $HOME/.bashrc'",