Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#515 raise if --config is passed but file does not exist #516

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pebblo/app/config/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pathlib
from contextvars import ContextVar
from typing import Tuple, Union
from typing import Tuple, Union, Optional

import yaml
from pydantic import Field
Expand Down Expand Up @@ -68,7 +68,7 @@ class Config(BaseSettings):
var_server_config_dict: ContextVar[dict] = ContextVar("server_config_dict", default={})


def load_config(path: str) -> Tuple[dict, Config]:
def load_config(path: Optional[str]) -> Tuple[dict, Config]:
try:
# If Path does not exist in command, set default config value
conf_obj = Config(
Expand Down
3 changes: 3 additions & 0 deletions pebblo/app/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import argparse
import os
import warnings

from tqdm import tqdm
Expand Down Expand Up @@ -35,6 +36,8 @@ def start():
exit(0)

path = args.config
if path is not None and not os.path.exists(path):
raise FileNotFoundError(f"'--config' was passed but config file '{path}' does not exist.")
p_bar = tqdm(range(10))
config_details, server_config = load_config(path)
var_server_config_dict.set(config_details)
Expand Down
Loading