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.

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)¶

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.

Parameters:

data (Any)

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"
)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

classmethod validate_command_not_empty(v)¶

Validate command has executable and no empty strings.

Parameters:

v (List[str])

Return type:

List[str]

classmethod validate_environment_vars(v)¶

Validate environment variable names and values.

Parameters:

v (Dict[str, str])

Return type:

Dict[str, str]

classmethod validate_name_format(v)¶

Validate name follows naming convention.

Parameters:

v (str)

Return type:

str

classmethod validate_working_directory(v)¶

Validate working directory if provided.

Parameters:

v (Optional[str])

Return type:

Optional[str]

model_config¶

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

class dataflow.server_management.models.BaseServerInfo(/, **data)¶

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.

Parameters:

data (Any)

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

Return type:

float

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

record_health_check(success)¶

Record health check result.

Parameters:

success (bool)

Return type:

None

update_status(new_status, error=None)¶

Update server status with optional error message.

Parameters:
Return type:

None

property is_running: bool¶

Check if server process is currently running.

Return type:

bool

model_config¶

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

property uptime_seconds: float¶

Calculate server uptime in seconds.

Return type:

float

class dataflow.server_management.models.ServerStatus¶

Bases: str, enum.Enum

Universal server status enum.

Initialize self. See help(type(self)) for accurate signature.