dataflow.server_management.modelsΒΆ

Base models for server management.

This module defines the fundamental Pydantic models used for server configuration and runtime information across all server types.

AttributesΒΆ

ClassesΒΆ

BaseServerConfig

Base configuration all servers must have.

BaseServerInfo

Base runtime info all servers have.

ServerStatus

Universal server status enum.

Module ContentsΒΆ

class dataflow.server_management.models.BaseServerConfig(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Base configuration all servers must have.

This model defines the minimum configuration required for any server type. Subclasses should extend this with type-specific fields.

nameΒΆ

Unique server identifier

commandΒΆ

Command to execute (executable + args)

descriptionΒΆ

Human-readable description

working_directoryΒΆ

Optional working directory for process

environmentΒΆ

Additional environment variables

timeout_secondsΒΆ

Startup timeout in seconds

auto_restartΒΆ

Whether to restart on failure

health_check_enabledΒΆ

Whether to perform health checks

Example

Basic server configuration:

config = BaseServerConfig(
    name="my-server",
    command=["python", "-m", "server"],
    description="My custom server"
)
classmethod validate_command_not_empty(v: List[str]) List[str]ΒΆ

Validate command has executable and no empty strings.

classmethod validate_environment_vars(v: Dict[str, str]) Dict[str, str]ΒΆ

Validate environment variable names and values.

classmethod validate_name_format(v: str) strΒΆ

Validate name follows naming convention.

classmethod validate_working_directory(v: str | None) str | NoneΒΆ

Validate working directory if provided.

auto_restart: bool = NoneΒΆ
command: List[str] = NoneΒΆ
description: str = NoneΒΆ
environment: Dict[str, str] = NoneΒΆ
health_check_enabled: bool = NoneΒΆ
model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str = NoneΒΆ
timeout_seconds: int = NoneΒΆ
working_directory: str | None = NoneΒΆ
class dataflow.server_management.models.BaseServerInfo(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Base runtime info all servers have.

This model represents the runtime state of a server process. It excludes the actual process handle from serialization.

nameΒΆ

Server name

pidΒΆ

Process ID

statusΒΆ

Current server status

started_atΒΆ

When the server was started

config_snapshotΒΆ

Configuration used to start server

error_messageΒΆ

Last error message if any

restart_countΒΆ

Number of times server has been restarted

last_health_checkΒΆ

Last successful health check time

uptime_secondsΒΆ

Computed uptime in seconds

record_health_check(success: bool) NoneΒΆ

Record health check result.

update_status(new_status: ServerStatus, error: str | None = None) NoneΒΆ

Update server status with optional error message.

config_snapshot: Dict[str, Any] = NoneΒΆ
error_message: str | None = NoneΒΆ
property is_running: boolΒΆ

Check if server process is currently running.

last_health_check: datetime.datetime | None = NoneΒΆ
model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str = NoneΒΆ
pid: int = NoneΒΆ
process_handle: Any | None = NoneΒΆ
restart_count: int = NoneΒΆ
started_at: datetime.datetime = NoneΒΆ
status: ServerStatus = NoneΒΆ
property uptime_seconds: floatΒΆ

Calculate server uptime in seconds.

class dataflow.server_management.models.ServerStatusΒΆ

Bases: str, enum.Enum

Universal server status enum.

ERROR = 'error'ΒΆ
HEALTH_CHECK_FAILED = 'health_check_failed'ΒΆ
RESTARTING = 'restarting'ΒΆ
RUNNING = 'running'ΒΆ
STARTING = 'starting'ΒΆ
STOPPED = 'stopped'ΒΆ
STOPPING = 'stopping'ΒΆ
dataflow.server_management.models.loggerΒΆ