Skip to content

Commit

Permalink
feat: configurable worker session root directory
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Usiskin <56369778+jusiskin@users.noreply.github.com>
  • Loading branch information
jusiskin committed Dec 19, 2024
1 parent 5726d1c commit c8af5dd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/deadline_test_fixtures/deadline/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
]
Expand Down Expand Up @@ -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'",
Expand Down

0 comments on commit c8af5dd

Please sign in to comment.