acupedia-ops/acupedia_ops/local/services.py

40 lines
1.0 KiB
Python

from __future__ import annotations
from typing import Iterable
from acupedia_ops.common.process import run_command
from acupedia_ops.local.workspace import LocalWorkspace
def setup_component(
workspace: LocalWorkspace,
component: str,
) -> None:
config = workspace.components[component]
if not config.setup_command:
raise RuntimeError(
f"No setup command configured for local component: {component}"
)
run_command(config.setup_command, cwd=workspace.path(component))
def run_component(
workspace: LocalWorkspace,
component: str,
) -> None:
config = workspace.components[component]
print(config)
if not config.run_command:
raise RuntimeError(
f"No run command configured for local component: {component}"
)
run_command(config.run_command, cwd=workspace.path(component))
def setup_components(
workspace: LocalWorkspace,
components: Iterable[str],
) -> None:
for component in components:
setup_component(workspace, component)