Skip to content

Commit

Permalink
refactor!: improve support for ec2 instance workers
Browse files Browse the repository at this point in the history
Problem:

The PosixInstanceWorker and WindowsInstanceWorker classes implement a
CMF Worker based on an ec2 host. In both cases they start with an empty
AMI image (AL2023 or Win Server 2022) then set up users, install the
agent, etc. Tests that need to use an AMI that already has users and the
agent installed end up having to hack around a lot of assumptions in
these classes, or reimplement everything for an ec2-based worker from
scratch.

Solution:

Refactor the PosixInstanceWorker and WindowsInstanceWorker to split them
into os-specific base classes that contain all of the generic worker
implementation stuff (starting the worker, getting its id, etc), and a
derived class that implements the user-setup, agent install, and the
like. This makes space for tests that use an AMI with the users & agent
pre-setup to derive from the os-specific base classes to get the generic
ec2-worker test functionality.

BREAKING CHANGE: PosixInstanceWorker has been renamed to
PosixInstanceBuildWorker, and WindowsInstanceWorker has been renamed to
WindowsInstanceBuildWorker.

Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
  • Loading branch information
ddneilson committed Aug 15, 2024
1 parent 3f71f51 commit e20a836
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 179 deletions.
12 changes: 8 additions & 4 deletions src/deadline_test_fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
DeadlineWorkerConfiguration,
DockerContainerWorker,
EC2InstanceWorker,
WindowsInstanceWorker,
PosixInstanceWorker,
WindowsInstanceWorkerBase,
WindowsInstanceBuildWorker,
PosixInstanceWorkerBase,
PosixInstanceBuildWorker,
Job,
Farm,
Fleet,
Expand Down Expand Up @@ -53,8 +55,10 @@
"DeadlineWorkerConfiguration",
"DockerContainerWorker",
"EC2InstanceWorker",
"WindowsInstanceWorker",
"PosixInstanceWorker",
"WindowsInstanceWorkerBase",
"WindowsInstanceBuildWorker",
"PosixInstanceWorkerBase",
"PosixInstanceBuildWorker",
"Farm",
"Fleet",
"Job",
Expand Down
12 changes: 8 additions & 4 deletions src/deadline_test_fixtures/deadline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
DeadlineWorkerConfiguration,
DockerContainerWorker,
EC2InstanceWorker,
PosixInstanceWorker,
WindowsInstanceWorker,
PosixInstanceWorkerBase,
PosixInstanceBuildWorker,
WindowsInstanceWorkerBase,
WindowsInstanceBuildWorker,
PipInstall,
)

Expand All @@ -29,8 +31,10 @@
"DeadlineWorkerConfiguration",
"DockerContainerWorker",
"EC2InstanceWorker",
"WindowsInstanceWorker",
"PosixInstanceWorker",
"WindowsInstanceWorkerBase",
"WindowsInstanceBuildWorker",
"PosixInstanceWorkerBase",
"PosixInstanceBuildWorker",
"Farm",
"Fleet",
"Job",
Expand Down
Loading

0 comments on commit e20a836

Please sign in to comment.