Skip to content

Commit

Permalink
respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Nov 12, 2024
1 parent 5365a18 commit ab8aaf1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/blueapi/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from bluesky_stomp.models import Broker
from observability_utils.tracing import setup_tracing
from pydantic import ValidationError
from pydantic_settings.sources import PathType
from requests.exceptions import ConnectionError

from blueapi import __version__
Expand All @@ -32,7 +33,7 @@
"-c", "--config", type=Path, help="Path to configuration YAML file", multiple=True
)
@click.pass_context
def main(ctx: click.Context, config: Path | None | tuple[Path, ...]) -> None:
def main(ctx: click.Context, config: PathType) -> None:
# Override default yaml_file path in the model_config if `config` is provided
ApplicationConfig.model_config["yaml_file"] = config
app_config = ApplicationConfig() # Instantiates with customized sources
Expand Down
4 changes: 3 additions & 1 deletion src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class ApplicationConfig(BaseSettings, cli_parse_args=True, cli_prog_name="blueap
)

@classmethod
def customize_sources(cls, init_settings, env_settings, file_secret_settings):
def settings_customize_sources(
cls, init_settings, env_settings, file_secret_settings
):
path = cls.model_config.get("yaml_file")
return (
init_settings,
Expand Down
10 changes: 9 additions & 1 deletion src/blueapi/service/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
from blueapi.worker.task_worker import TaskWorker, TrackableTask

"""This module provides interface between web application and underlying Bluesky
context and worker"""
context and worker
the _CONFIG global variable is used by the subprocess only
"""


_CONFIG: ApplicationConfig = ApplicationConfig()
Expand All @@ -26,6 +30,10 @@ def config() -> ApplicationConfig:


def set_config(new_config: ApplicationConfig):
"""
This is a setter function that the main process uses
to pass the config into the subprocess
"""
global _CONFIG

_CONFIG = new_config
Expand Down

0 comments on commit ab8aaf1

Please sign in to comment.