Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: FleetAPI compatibility for WorkerRequirements #80

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/deadline_test_fixtures/deadline/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ def create_fleet(self, *args, **kwargs) -> Any:
and "workeRoleArn" in create_fleet_input_members
):
kwargs["workerRoleArn"] = kwargs.pop("roleArn")

if "configuration" in create_fleet_input_members:
customer_managed_members = (
create_fleet_input_members["configuration"].members["customerManaged"].members
)

if (
"workerCapabilities" not in customer_managed_members
and "workerRequirements" in customer_managed_members
):
if (
"customerManaged" in kwargs["configuration"]
and "workerCapabilities" in kwargs["configuration"]["customerManaged"]
):
kwargs["configuration"]["customerManaged"]["workerRequirements"] = kwargs[
"configuration"
]["customerManaged"].pop("workerCapabilities")

return self._real_client.create_fleet(*args, **kwargs)

def get_fleet(self, *args, **kwargs) -> Any:
Expand Down
10 changes: 6 additions & 4 deletions src/deadline_test_fixtures/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def deletable(resource: T) -> Generator[T, None, None]:
configuration={
"customerManaged": {
"mode": "NO_SCALING",
"workerRequirements": {
"workerCapabilities": {
"vCpuCount": {"min": 1},
"memoryMiB": {"min": 1024},
"osFamily": "linux",
Expand Down Expand Up @@ -352,9 +352,11 @@ def deletable(resource: T) -> Generator[T, None, None]:
farm_id=farm.id,
queue_id=queue.id,
fleet_id=fleet.id,
job_attachments_bucket=bootstrap_resources.job_attachments.bucket_name
if bootstrap_resources.job_attachments
else None,
job_attachments_bucket=(
bootstrap_resources.job_attachments.bucket_name
if bootstrap_resources.job_attachments
else None
),
)


Expand Down