Skip to content

test: Adjust workers for start service disabled#185

Merged
hindleym merged 5 commits intoaws-deadline:mainlinefrom
hindleym:hindleym-check-start-service-in-worker
Apr 24, 2025
Merged

test: Adjust workers for start service disabled#185
hindleym merged 5 commits intoaws-deadline:mainlinefrom
hindleym:hindleym-check-start-service-in-worker

Conversation

@hindleym
Copy link
Contributor

What was the problem/requirement? (What/Why)

  • The tests would fail if the start-service flag was set to false
  • Windows instances didn't check if the flag was enabled or not
  • Linux used the get_worker_id(), even if the worker wasn't started

What was the solution? (How)

  • Added the start service check to the Windows _start_worker_agent() function
  • Simplified the start_worker_service() function
  • Changed when calling get_worker_id()

What is the impact of this change?

Improves test framework to handle the start-service flag

How was this change tested?

Verified locally against the Windows and Linux E2E tests

Was this change documented?

No

Is this a breaking change?

No


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Signed-off-by: Church Hindley <59745380+hindleym@users.noreply.github.com>
@hindleym
Copy link
Contributor Author

These deadline-cloud-test-fixtures/worker.py updates are needed for aws-deadline/deadline-cloud-worker-agent#603

else:
raise TimeoutError

def wait_until_worker_stopping(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, can we make wait_until_stopped and wait_until_worker_stopping share a function? The function wait_until_X can just pass in the state to wait for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified these to wait_until_desired_worker_status

)
assert cmd_result.exit_code == 0, f"Failed to configure Worker agent: {cmd_result}"
LOG.info("Successfully configured Worker agent")
LOG.info("Sending SSM Command to check if Worker Agent is running")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this check was moved below? I'm not sure of the code all path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the diff here for _start_worker_agent vs start_worker_service for your testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to how we handle this with Linux here.

If start-service is set to False, we want to make sure that the checks for the service to be running don't occur when installing the agent.

_start_worker_agent() is part of the base class and is called when the worker is created with .start().

start_worker_service() allows us to start the worker at a later time, using the installed configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it sense to rename _start_worker_agent to _setup_worker_agent or something like that to avoid future confusion?

@hindleym hindleym force-pushed the hindleym-check-start-service-in-worker branch from 8d18d6d to 0ffbb3a Compare April 24, 2025 00:38
Signed-off-by: Church Hindley <59745380+hindleym@users.noreply.github.com>
Signed-off-by: Church Hindley <59745380+hindleym@users.noreply.github.com>
LOG.exception(f"Failed to delete worker: {error}")
raise

def wait_until_stopped(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an API that is consumed in other packages, please don't just change the name.

What I'm suggesting is:

def wait_until_stopped():
    wait_until_desired_worker_status(desired_status="STOPPED"

Signed-off-by: Church Hindley <59745380+hindleym@users.noreply.github>
@sonarqubecloud
Copy link

@hindleym hindleym requested a review from leongdl April 24, 2025 20:02
)
assert cmd_result.exit_code == 0, f"Failed to configure Worker agent: {cmd_result}"
LOG.info("Successfully configured Worker agent")
LOG.info("Sending SSM Command to check if Worker Agent is running")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it sense to rename _start_worker_agent to _setup_worker_agent or something like that to avoid future confusion?


def start_worker_service(self):
LOG.info("Sending command to start the Worker Agent service")
LOG.info("Sending command to start the Worker Agent service - Added comma")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we mean to add this "- Added comma" here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I meant to get rid of that. I'll make sure to get that with my next set of changes.

@hindleym hindleym merged commit 3920369 into aws-deadline:mainline Apr 24, 2025
16 checks passed
@hindleym hindleym deleted the hindleym-check-start-service-in-worker branch April 29, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants