Source code for laborchestrator.start_up.default_config
"""
Contains the default values for orchestrator startup.
Provide a python file overwriting the defaults to change them. See the adaption template for an example.
"""
from dataclasses import dataclass
from laborchestrator.engine import BaseWorker
from laborchestrator.database_integration.status_db_interface import StatusDBInterface
from typing import Dict, Optional, Type
from types import ModuleType
import importlib.util
import sys
from pathlib import Path
example_dir = Path(__file__).parent
[docs]
def load_default_process_module() -> ModuleType:
"""Load the test_data module from the tests directory."""
module_file = example_dir / "example_processes" / "__init__.py"
if not module_file.exists():
raise FileNotFoundError(f"Cannot find default test_data module at {module_file}")
spec = importlib.util.spec_from_file_location("example_processes", str(module_file))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
sys.modules["example_processes"] = module
return module
[docs]
@dataclass
class LabOrchestratorConfig:
# Orchestrator
reader: str = "PythonLab"
worker_type: Type[BaseWorker] = BaseWorker
default_scheduling_time: int = 1
# Dash
dash_port: int = 8050
process_module: ModuleType = load_default_process_module()
arm_open: bool = True
db_open: bool = True
browser_open: bool = True
# Scheduler
lab_config_file: str = str(example_dir / "default_lab_config.yml")
scheduling_algorithm: str = "BottleneckPD"
# DB
db_client: StatusDBInterface | None = None
# GUI
# Optional mapping of device name -> gantt chart bar color. If None, plotly
# auto-assigns colors per device.
device_colors: Optional[Dict[str, str]] = None