From 5dad7ed90d71ec0af5ac9e3f2e493965a5a07eb5 Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Thu, 19 Oct 2023 18:12:55 -0500 Subject: [PATCH] Re-lint after merge --- .pre-commit-config.yaml | 1 - openff/bespokefit/_version.py | 2 +- openff/bespokefit/cli/worker.py | 10 ++++--- .../executor/services/qcgenerator/qcengine.py | 2 +- openff/bespokefit/executor/utilities/redis.py | 29 ++++++++++++------- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb1b861e..2c591a31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: rev: v3.1.0 hooks: - id: add-trailing-comma - args: ["--py36-plus"] - repo: https://github.com/psf/black rev: 23.10.0 hooks: diff --git a/openff/bespokefit/_version.py b/openff/bespokefit/_version.py index 971aaef1..f4b22426 100644 --- a/openff/bespokefit/_version.py +++ b/openff/bespokefit/_version.py @@ -16,7 +16,7 @@ import re import subprocess import sys -from typing import Any, Callable, Dict, List, Optional, Tuple +from typing import Any, Callable, Optional def get_keywords() -> dict[str, str]: diff --git a/openff/bespokefit/cli/worker.py b/openff/bespokefit/cli/worker.py index bd7f3ccf..e809b8e5 100644 --- a/openff/bespokefit/cli/worker.py +++ b/openff/bespokefit/cli/worker.py @@ -1,3 +1,4 @@ +"""Host of `launch-worker` CLI command.""" import importlib import click @@ -25,16 +26,17 @@ def worker_cli(worker_type: str): Used to connect workers to a remote bespokefit server. Note: - + ---- By default bespokefit will automatically use all cores and memory made available to the worker which should be declared in the job submission script. To change these defaults see the settings `BEFLOW_QC_COMPUTE_WORKER_N_CORES` & `BEFLOW_QC_COMPUTE_WORKER_MAX_MEM`. - Args: + Parameters + ---------- + worker_type: str + The alias name of the worker type which should be started. - worker_type: The alias name of the worker type which should be started. """ - pretty.install() console = rich.get_console() diff --git a/openff/bespokefit/executor/services/qcgenerator/qcengine.py b/openff/bespokefit/executor/services/qcgenerator/qcengine.py index 4aaac6cb..f172a594 100644 --- a/openff/bespokefit/executor/services/qcgenerator/qcengine.py +++ b/openff/bespokefit/executor/services/qcgenerator/qcengine.py @@ -1,5 +1,5 @@ """Generate QC data using QCEngine.""" -from multiprocessing import Pool, current_process, get_context +from multiprocessing import current_process, get_context from typing import Union from qcelemental.models import FailedOperation diff --git a/openff/bespokefit/executor/utilities/redis.py b/openff/bespokefit/executor/utilities/redis.py index 26d38136..a98a019f 100644 --- a/openff/bespokefit/executor/utilities/redis.py +++ b/openff/bespokefit/executor/utilities/redis.py @@ -14,7 +14,8 @@ __REDIS_VERSION: int = 1 __CONNECTION_POOL: dict[ - tuple[str, int, Optional[int], Optional[str], bool], redis.Redis + tuple[str, int, Optional[int], Optional[str], bool], + redis.Redis, ] = {} @@ -51,10 +52,13 @@ def connect_to_default_redis(validate: bool = True) -> redis.Redis: def connect_to_redis( - host: str, port: int, db: int, validate: bool = True, password: Optional[str] = None + host: str, + port: int, + db: int, + validate: bool = True, + password: Optional[str] = None, ) -> redis.Redis: - """Connects to a redis server using the specified settings.""" - + """Connect to a redis server using the specified settings.""" connection_key = (host, port, db, password, validate) if connection_key in __CONNECTION_POOL: @@ -87,12 +91,11 @@ def connect_to_redis( def is_redis_available( - host: str, port: int = 6363, password: Optional[str] = None + host: str, + port: int = 6363, + password: Optional[str] = None, ) -> bool: - """Returns whether a server running on the local host on a particular port is - available. - """ - + """Return whether a server running on the local host on a particular port is available.""" redis_client = redis.Redis(host=host, port=port, password=password) try: @@ -135,7 +138,9 @@ def launch_redis( ) if is_redis_available( - host="localhost", port=port, password=settings.BEFLOW_REDIS_PASSWORD + host="localhost", + port=port, + password=settings.BEFLOW_REDIS_PASSWORD, ): raise RuntimeError(f"There is already a server running at localhost:{port}") @@ -168,7 +173,9 @@ def launch_redis( for i in range(0, 60): if is_redis_available( - host="localhost", port=port, password=settings.BEFLOW_REDIS_PASSWORD + host="localhost", + port=port, + password=settings.BEFLOW_REDIS_PASSWORD, ): timeout = False break