executionflags

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

Execution allocation inputs

This is the shared input parser used by run, run one, run with-lease, submit --run, list, and list children. Run paths inject the actual allocation into both recipe preflight and pending-task lease checks.

Bind Options.AddFlags to a command's local flag set. At execution time, pass os.LookupEnv to Options.Parse, then inject the resulting versioned allocation into the worker. Argument values override the corresponding environment field independently, allowing mixed sources. Explicit empty arguments or environment values are invalid; omitted values remain unknown. Parsing does not inspect host capacity or use recipe requests as evidence of allocation.

Argument Environment Meaning
--execution-cpu C2J_EXECUTION_CPU Usable cores/millicores
--execution-memory C2J_EXECUTION_MEMORY Usable memory
--execution-ephemeral-storage C2J_EXECUTION_EPHEMERAL_STORAGE Usable scratch
--execution-platform C2J_EXECUTION_PLATFORM OS/architecture/optional variant
--execution-image C2J_EXECUTION_IMAGE Launch reference/tag
--execution-image-digest C2J_EXECUTION_IMAGE_DIGEST Actual manifest digest
--execution-image-id C2J_EXECUTION_IMAGE_ID Runtime/config identity, diagnostic only

List commands call ParseFilter with their explicit --compatible-with-execution and --include-unresolved choices. Without compatibility opt-in, environment variables are not read and allocation flags are rejected. With opt-in, at least one compatibility-relevant allocation fact is required; an image ID alone is insufficient. IncludeUnresolved admits unknown jobs for default-environment bootstrap, not as proven compatible jobs. This package parses the candidate; it does not perform listing or pagination.

Run go test ./cmd/c2j/internal/executionflags for precedence, unknown-input, validation, image-identity, and list opt-in tests.

Documentation

Overview

Package executionflags is the shared argument/environment boundary for run allocation injection and opt-in list compatibility filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRequirementFlags added in v0.0.52

func AddRequirementFlags(flags *pflag.FlagSet, r *execution.Requirements)

AddRequirementFlags binds job overrides, never actual allocation facts.

Types

type Filter

type Filter = execution.Filter

Filter is a candidate descriptor, not a lease request. An unresolved job can be included as a bootstrap candidate, but must never be labeled compatible.

type Options

type Options struct {
	CPU              *string
	Memory           *string
	EphemeralStorage *string
	Platform         *string
	Image            *string
	ImageDigest      *string
	ImageID          *string
}

Options preserves presence so an explicit empty argument cannot fall back to an environment value. Environment lookup happens at execution, not binding.

func (*Options) AddFlags

func (o *Options) AddFlags(flags *pflag.FlagSet)

func (Options) HasArguments added in v0.0.52

func (o Options) HasArguments() bool

HasArguments reports explicit allocation arguments, without inspecting the environment. Submission uses this to reject allocation-only flags without run.

func (Options) Parse

func (o Options) Parse(lookupEnv func(string) (string, bool)) (execution.Allocation, error)

Parse resolves each argument independently ahead of its corresponding environment variable. No host detection, deployment defaults, or requested requirements are used as evidence of actual capacity. Pass os.LookupEnv in production, or nil to ignore the environment.

func (Options) ParseFilter

func (o Options) ParseFilter(enabled, includeUnresolved bool, lookupEnv func(string) (string, bool)) (*Filter, error)

ParseFilter does not inspect inherited allocation variables without explicit opt-in. In particular, listing children inside a worker must not silently hide children that require a different environment.

Jump to

Keyboard shortcuts

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