resourcelimit

package
v2.11.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithGuard

func WithGuard(ctx context.Context, guard *Guard) context.Context

WithGuard stores a resource guard in context.

Types

type Guard

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

Guard owns an OS-specific resource limit scope for a DAG run.

func FromContext

func FromContext(ctx context.Context) *Guard

FromContext returns the resource guard stored in context, if present.

func Start

func Start(ctx context.Context, opts Options) *Guard

Start attempts to prepare OS-native resource enforcement. It never returns an error because resource enforcement is a best-effort runtime capability.

func (*Guard) AssignProcess

func (g *Guard) AssignProcess(pid int) error

AssignProcess adds a process to the resource-limited scope.

func (*Guard) Close

func (g *Guard) Close(ctx context.Context) error

Close releases guard resources.

func (*Guard) Result

func (g *Guard) Result() Result

Result returns enforcement status for the guard.

type Options

type Options struct {
	DAGName  string
	DAGRunID string
	Limits   *core.ResourceLimits
}

Options describes resource limits for one DAG run.

type Result

type Result struct {
	Enforced bool
	Enforcer string
	Warning  string
}

Result describes whether the requested limits are enforced.

Jump to

Keyboard shortcuts

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