Workload Configs

Debug Config

class kubetorch.DebugConfig(mode: Literal['pdb', 'pdb-ui'] = 'pdb', port: int = 5678)

Configuration for debugging mode.

mode

Debug mode - “pdb” (default, WebSocket PTY) or “pdb-ui” (web-based UI)

Type:

Literal[‘pdb’, ‘pdb-ui’]

port

Debug port (default: 5678)

Type:

int

__init__(mode: Literal['pdb', 'pdb-ui'] = 'pdb', port: int = 5678) None

Logging Config

class kubetorch.LoggingConfig(stream_logs: bool | None = None, level: Literal['debug', 'info', 'warning', 'error'] = 'info', include_system_logs: bool = False, include_events: bool = True, grace_period: float = 2.0, include_name: bool = True, poll_timeout: float = 1.0, grace_poll_timeout: float = 0.5, shutdown_grace_period: float = 0)

Configuration for logging behavior on a Kubetorch service.

This config is set at the Compute level and applies to all calls made to that service. It controls both runtime log streaming (during method calls) and startup log streaming (during .to() deployment).

stream_logs

Whether log streaming is enabled for this service. When True, logs from the remote compute are streamed back to the client during calls and service startup. Individual calls can override this with stream_logs=False. If None, falls back to global config.stream_logs setting. Default: True

Type:

bool

level

Log level for the remote service. Controls which logs are emitted by the service and available for streaming. Also controls client-side filtering. Options: “debug”, “info”, “warning”, “error”. Default: “info”

Type:

Literal[‘debug’, ‘info’, ‘warning’, ‘error’]

include_system_logs

Whether to include framework logs (e.g., uvicorn.access). Default: False (only show application logs)

Type:

bool

include_events

Whether to include Kubernetes events during service startup. Events include pod scheduling, image pulling, container starting, etc. Default: True

Type:

bool

grace_period

Seconds to continue streaming after request completes, to catch any final logs that arrive late. Default: 2.0

Type:

float

include_name

Whether to prepend pod/service name to each log line. Default: True

Type:

bool

poll_timeout

Timeout in seconds for WebSocket receive during normal streaming. Default: 1.0

Type:

float

grace_poll_timeout

Timeout in seconds for WebSocket receive during grace period. Shorter timeout allows faster shutdown while still catching late logs. Default: 0.5

Type:

float

shutdown_grace_period

Seconds to block the main thread after the HTTP call completes, waiting for the log streaming thread to finish. This prevents the Python interpreter from exiting before final logs are printed. Set to 0 for no blocking (default), or a few seconds (e.g., 3.0) if you need to ensure wrap-up logs from the remote compute are captured. Default: 0

Type:

float

__init__(stream_logs: bool | None = None, level: Literal['debug', 'info', 'warning', 'error'] = 'info', include_system_logs: bool = False, include_events: bool = True, grace_period: float = 2.0, include_name: bool = True, poll_timeout: float = 1.0, grace_poll_timeout: float = 0.5, shutdown_grace_period: float = 0) None

Metrics Config

class kubetorch.MetricsConfig(interval: int = 30, scope: Literal['pod', 'resource'] = 'resource')

Configuration for streaming metrics during a Kubetorch service call.

interval

Time between two consecutive metrics outputs, in seconds. Default: 30.

Type:

int

scope

Metrics aggregation level. Options: “pod”, “resource”. Default: “resource”

Type:

Literal[‘pod’, ‘resource’]

__init__(interval: int = 30, scope: Literal['pod', 'resource'] = 'resource') None