pod_runner
Contains courtesy classes and functions for making pod running easier.
Module
Functions
fetch_datasources_from_hub
def fetch_datasources_from_hub( hub: BitfountHub,) ‑> list[DatasourceContainerConfig]:Fetch datasource configurations from the hub compute cluster API.
Arguments
hub: Authenticated hub client, optionally scoped to a compute cluster.
Returns Datasource container configs deserialized from the hub.
load_pod_config
def load_pod_config( path_to_config_yaml: str | PathLike[str] | None = None,) ‑> PodConfig:Load pod configuration from a YAML file and/or environment variables.
If a config file is found it is parsed first, then pod bootstrap settings
from the current pod bootstrap environment variables override matching fields
when set. An optional cluster_id may also be set in the YAML file.
If no config file exists, BITFOUNT_USERNAME is required and
BITFOUNT_CLUSTER_ID is required unless BITFOUNT_API_KEY_ID and
BITFOUNT_API_KEY are set. When no pod name is configured,
the installation UUID is used.
Arguments
path_to_config_yaml: Optional explicit path to a pod config YAML file.
Returns The loaded PodConfig.
Raises
ValueError: If no config file exists and required env vars are missing.
parse_pod_config_file
def parse_pod_config_file( path_to_config_yaml: str | PathLike[str],) ‑> PodConfig:Parses a pod YAML config file into a PodConfig instance.
Arguments
path_to_config_yaml: The path to the config file.
Returns The parsed PodConfig.
setup_datasource
def setup_datasource( datasource_config: DatasourceConfig,) ‑> DatasourceContainerConfig:Creates a BaseSource from a DatasourceConfig.
Arguments
datasource_config: The configuration as a DatasourceConfig instance.
Returns The created DatasourceContainerConfig.
setup_pod_from_config
def setup_pod_from_config( config: PodConfig, orchestrator_url: str | None = None, register_datasets: bool = True,) ‑> Pod:Creates a pod from a loaded config.
Arguments
config: The configuration as a PodConfig instance.orchestrator_url: Optional base URL of the local orchestrator (e.g."http://localhost:29207"). When provided, the pod will POST to<orchestrator_url>/events/pod/datasets-updatedwhenever new datasets come online at runtime, so the orchestrator can schedule background metadata collection for them immediately.register_datasets: Whether to register the datasets and upload their schemas to the Hub. Defaults to True. When False the pod is built read-only: schemas are loaded (never regenerated) and never uploaded, so an ephemeral task-runner cannot overwrite the schema produced byrun_pod's Prefect schema-generation task.
Returns The created pod.
setup_pod_from_config_file
def setup_pod_from_config_file( path_to_config_yaml: str | PathLike[str], register_datasets: bool = True,) ‑> Pod:Creates a pod from a YAML config file.
Pod bootstrap environment variables override matching YAML fields when set.
Arguments
path_to_config_yaml: The path to the config file.register_datasets: Whether to register the datasets and upload their schemas to the Hub. Defaults to True. Pass False for read-only task-runner pods (run_background_task/run_interactive_task) so they consume the existing schema without overwriting it.
Returns The created pod.
setup_pod_from_loaded_config
def setup_pod_from_loaded_config( path_to_config_yaml: str | PathLike[str] | None = None, orchestrator_url: str | None = None,) ‑> Pod:Creates a pod from a YAML config file and/or environment variables.
Arguments
path_to_config_yaml: Optional path to the config file.orchestrator_url: Optional base URL of the local orchestrator.
Returns The created pod.