Exemple #1
0
def basic_config(name):
    """Load configuration and setup logs."""
    default_config_path = CONFIG_DIR_PATH / f"{ name }_config.yaml"
    base_config_path = os.environ.get(f"LATIGO_{ name.upper() }_CONFIG_FILE")

    config, err = load_configs(default_config_path, base_config_path)
    get_config = partial(get_nested_config_value, config, name)

    # Ensure logging is configured even if there is no config.
    setup_logging(
        f"latigo-{ name }",
        enable_azure_logging=get_config("azure_monitor_logging_enabled"),
        azure_monitor_instrumentation_key=get_config("azure_monitor_instrumentation_key"),
        log_debug_enabled=get_config("log_debug_enabled"),
    )

    if not config:
        logger.error(f"Could not load configuration for %s: %r", name, err)
        sys.exit(1)

    return config
Exemple #2
0
#!/usr/bin/env python

import sys
import pprint
from os import environ
from latigo.log import setup_logging

logger = setup_logging("latigo.app.executor")
from latigo.utils import load_config
from latigo.executor import PredictionExecutor


logger.info(f"Starting Latigo Executor")

# Augment loaded config with variables from environment
# fmt: off
# NOTE: REMEMBER TO UPDATE DOCKER FILES AS WELL TO PRORPERLY PROPEGATE VALUES
not_found=None #"environemnt variable not found"
config_overlay = {
    "executor": {
        "name": environ.get("LATIGO_INSTANCE_NAME", "unnamed_executor"),
    },
    "task_queue": {
        "connection_string": environ.get("LATIGO_INTERNAL_EVENT_HUB", not_found),
    },
    "model_info":{
        "connection_string": environ.get("LATIGO_GORDO_CONNECTION_STRING", not_found),
        "auth":{
            "resource": environ.get("LATIGO_GORDO_RESOURCE", not_found),
            "tenant" : environ.get("LATIGO_GORDO_TENANT", not_found),
            "authority_host_url" : environ.get("LATIGO_GORDO_AUTH_HOST_URL", not_found),
Exemple #3
0
#!/usr/bin/env python

import sys
from os import environ
import pprint
from latigo.log import setup_logging

logger = setup_logging("latigo.app.scheduler")
from latigo.utils import load_config
from latigo.scheduler import Scheduler

logger.info("Starting Latigo Scheduler")

# Augment loaded config with variables from environment
# fmt: off
# NOTE: REMEMBER TO UPDATE DOCKER FILES AS WELL TO PRORPERLY PROPEGATE VALUES
not_found = None  #"environemnt variable not found"

config_overlay = {
    "scheduler": {
        "projects":
        environ.get("LATIGO_SCHEDULER_PROJECTS", "ioc-1130, ioc-1125"),
        "continuous_prediction_start_time":
        environ.get("LATIGO_SCHEDULER_PREDICTION_START_TIME", "08:00"),
        "continuous_prediction_interval":
        environ.get("LATIGO_SCHEDULER_PREDICTION_INTERVAL", "90m"),
        "continuous_prediction_delay":
        environ.get("LATIGO_SCHEDULER_PREDICTION_DELAY", "1d"),
        "name":
        environ.get("LATIGO_INSTANCE_NAME", "unnamed_scheduler"),
    },