Skip to content

Commit

Permalink
run fix-style
Browse files Browse the repository at this point in the history
  • Loading branch information
bgunnar5 committed Sep 24, 2024
1 parent 290d350 commit 8a1bc14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def path_to_test_specs() -> str:
"""
Fixture to provide the path to the directory containing test specifications.
This fixture returns the absolute path to the 'test_specs' directory
within the 'integration' folder of the test directory. It expands
This fixture returns the absolute path to the 'test_specs' directory
within the 'integration' folder of the test directory. It expands
environment variables and user home directory as necessary.
Returns:
Expand Down
19 changes: 10 additions & 9 deletions tests/integration/commands/test_stop_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import re
import shutil
import subprocess
import yaml
from enum import Enum
from typing import List

import yaml
from celery import Celery

from tests.integration.conditions import HasRegex
from tests.context_managers.celery_workers_manager import CeleryWorkersManager
from tests.integration.conditions import HasRegex


class WorkerMessages(Enum):
Expand All @@ -22,6 +22,7 @@ class WorkerMessages(Enum):
that we're expecting (or not expecting) to see from the
tests in this module.
"""

NO_WORKERS_MSG = "No workers found to stop"
STEP_1_WORKER = "step_1_merlin_test_worker"
STEP_2_WORKER = "step_2_merlin_test_worker"
Expand Down Expand Up @@ -59,14 +60,14 @@ def load_workers_from_spec(self, spec_filepath: str) -> dict:

# Initialize an empty dictionary to hold worker_info
worker_info = {}

# Access workers and steps from spec_contents
workers = spec_contents["merlin"]["resources"]["workers"]
study_steps = {step['name']: step['run']['task_queue'] for step in spec_contents['study']}
study_steps = {step["name"]: step["run"]["task_queue"] for step in spec_contents["study"]}

# Grab the concurrency and queues from each worker and add it to the worker_info dict
for worker_name, worker_settings in workers.items():
match = re.search(r'--concurrency\s+(\d+)', worker_settings["args"])
match = re.search(r"--concurrency\s+(\d+)", worker_settings["args"])
concurrency = int(match.group(1)) if match else 1
queues = [study_steps[step] for step in worker_settings["steps"]]
worker_info[worker_name] = {"concurrency": concurrency, "queues": queues}
Expand Down Expand Up @@ -237,7 +238,7 @@ def test_no_workers(
for condition in conditions:
condition.ingest_info(info)
assert condition.passes

def test_no_flags(
self,
redis_server: str,
Expand Down Expand Up @@ -336,7 +337,7 @@ def test_spec_flag(
path_to_test_specs,
merlin_server_dir,
conditions,
flag=f"--spec {os.path.join(path_to_test_specs, 'multiple_workers.yaml')}"
flag=f"--spec {os.path.join(path_to_test_specs, 'multiple_workers.yaml')}",
)

def test_workers_flag(
Expand Down Expand Up @@ -387,7 +388,7 @@ def test_workers_flag(
path_to_test_specs,
merlin_server_dir,
conditions,
flag=f"--workers {WorkerMessages.STEP_1_WORKER.value} {WorkerMessages.STEP_2_WORKER.value}"
flag=f"--workers {WorkerMessages.STEP_1_WORKER.value} {WorkerMessages.STEP_2_WORKER.value}",
)

def test_queues_flag(
Expand Down Expand Up @@ -438,5 +439,5 @@ def test_queues_flag(
path_to_test_specs,
merlin_server_dir,
conditions,
flag=f"--queues hello_queue"
flag=f"--queues hello_queue",
)

0 comments on commit 8a1bc14

Please sign in to comment.