python

package
v0.6.60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Overview

Package python executes the user-provided Python used by Helm value templating.

Scripts run in a fresh Gomonty REPL for every job. The package deliberately does not provide any Gomonty host callbacks, so scripts cannot access the operator process, filesystem, network, or environment.

Index

Constants

View Source
const (
	// ExecutionTimeout bounds queue admission and execution for one job.
	ExecutionTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func SetDefaultPool

func SetDefaultPool(pool *Pool)

SetDefaultPool installs the process-wide pool used by Helm rendering. The caller owns the pool and must close it during application shutdown.

Types

type Config

type Config struct {
	MaxConcurrentReconciles int
	WorkerCount             int
	QueueSize               int
	ExecutionTimeout        time.Duration
}

Config controls a Pool. WorkerCount and QueueSize are intended primarily for focused tests. Production callers should set MaxConcurrentReconciles so the fixed pool sizing policy is applied at startup.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool owns a fixed set of workers and a bounded queue. It is safe for concurrent use. Close waits for workers to stop and is idempotent.

func DefaultPool

func DefaultPool() *Pool

DefaultPool returns the pool installed by the application startup path.

func NewPool

func NewPool(maxConcurrentReconciles int) (*Pool, error)

NewPool creates and health-checks a fixed-size worker pool. The health check eagerly loads Gomonty's native runtime, making startup failures visible before the first service render.

func NewPoolWithConfig

func NewPoolWithConfig(config Config) (*Pool, error)

NewPoolWithConfig is the configurable constructor used by tests and by callers that need to provide an explicit pool size.

func (*Pool) Close

func (p *Pool) Close() error

Close stops accepting work, cancels executing jobs, and waits for all workers. Jobs that have not started are discarded with the pool.

func (*Pool) Run

func (p *Pool) Run(ctx context.Context, script string, bindings map[string]any) (Result, error)

Run submits one script to the bounded pool. The timeout starts before queue admission, so a queued job cannot extend the caller's end-to-end deadline.

type Result

type Result struct {
	Values      map[string]any
	ValuesFiles []string
}

Result is the strict shape returned by a Python templating script.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL