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¶
Base configuration all servers must have. |
|
Base runtime info all servers have. |
|
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.
- classmethod validate_environment_vars(v)¶
Validate environment variable names and values.
- classmethod validate_name_format(v)¶
Validate name follows naming convention.
- classmethod validate_working_directory(v)¶
Validate working directory if provided.
- 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
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:
new_status (ServerStatus)
error (Optional[str])
- Return type:
None
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].