From a69fdedc059dfaac2ed4bfc34195e111ef68aa9f Mon Sep 17 00:00:00 2001 From: Eric Osiowy <134728121+erico-aws@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:46:08 +0000 Subject: [PATCH] fix: BYO Deadline now looks specifically for resource env vars. Signed-off-by: Eric Osiowy <134728121+erico-aws@users.noreply.github.com> --- src/deadline_test_fixtures/fixtures.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/deadline_test_fixtures/fixtures.py b/src/deadline_test_fixtures/fixtures.py index 1024121..42e5141 100644 --- a/src/deadline_test_fixtures/fixtures.py +++ b/src/deadline_test_fixtures/fixtures.py @@ -281,21 +281,16 @@ def deadline_resources( """ if os.getenv("BYO_DEADLINE", "false").lower() == "true": kwargs: dict[str, Any] = {} + resource_env_vars: list[str] = [ + "FARM_ID", + "FLEET_ID", + "QUEUE_ID", + ] - all_fields = fields(DeadlineResources) - for f in all_fields: - env_var = f.name.upper() + for env_var in resource_env_vars: if env_var in os.environ: - kwargs[f.name] = os.environ[env_var] + kwargs[env_var.lower()] = os.environ[env_var] - required_fields = [f for f in all_fields if (MISSING == f.default == f.default_factory)] - assert all([rf.name in kwargs for rf in required_fields]), ( - "Not all Deadline resources have been fulfilled via environment variables. Expected " - + f"values for {[f.name.upper() for f in required_fields]}, but got {kwargs}" - ) - LOG.info( - f"All Deadline resources have been fulfilled via environment variables. Using {kwargs}" - ) yield DeadlineResources(**kwargs) else: LOG.info("Deploying Deadline resources")