worker

package
v0.0.0-...-6f916ce Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: Apache-2.0 Imports: 59 Imported by: 0

Documentation

Index

Constants

View Source
const EssTokenFileName = "jwt.token"

EssTokenFileName is the filename the ESS agent writes the JWT assertion token to. Kept local to avoid a cross-service module dependency on worker-init (which owns the ESS agent that produces this file).

Variables

View Source
var ErrUpstreamCancel = errors.New("upstream cancel via NATS")

Cause set on the request context when the IS broadcasts a cancel.

Functions

This section is empty.

Types

type Config

type Config struct {
	NVCFWorkerToken                     string        `mapstructure:"NVCF_WORKER_TOKEN"`
	NVCFFqdn                            string        `mapstructure:"NVCF_FQDN_GRPC"`
	NVCFFqdnNATS                        string        `mapstructure:"NVCF_FQDN_NATS"`
	NKeySeed                            *string       `mapstructure:"NKEY_SEED"` // will use the worker token if not set
	InferencePort                       int           `mapstructure:"INFERENCE_PORT"`
	InferenceHealthEndpoint             string        `mapstructure:"INFERENCE_HEALTH_ENDPOINT"`
	InferenceHealthProtocol             string        `mapstructure:"INFERENCE_HEALTH_PROTOCOL"`
	InferenceHealthTimeout              time.Duration `mapstructure:"INFERENCE_HEALTH_TIMEOUT"`
	InferenceHealthPort                 int           `mapstructure:"INFERENCE_HEALTH_PORT"`
	InferenceHealthExpectedResponseCode int           `mapstructure:"INFERENCE_HEALTH_EXPECTED_RESPONSE_CODE"`
	HelmChartInferenceServiceName       string        `mapstructure:"HELM_CHART_INFERENCE_SERVICE_NAME"`
	HelmChartNamespace                  string        `mapstructure:"HELM_CHART_NAMESPACE"`
	// The time.Duration unmarshal converts from a string, so suffixes are expected (ms, s, etc).
	// Because it can vary, we won't set a unit on the variable name.
	InferenceReadyTimeout          time.Duration `mapstructure:"INFERENCE_READY_TIMEOUT"`
	InfraMeteringHeartbeatInterval time.Duration `mapstructure:"INFRA_METERING_HEARTBEAT_INTERVAL_SECS"`
	OTELExporterOTLPEndpoint       string        `mapstructure:"OTEL_EXPORTER_OTLP_ENDPOINT"`
	TracingAccessToken             string        `mapstructure:"TRACING_ACCESS_TOKEN"`
	NcaId                          string        `mapstructure:"NCA_ID"`
	BillingNcaId                   string        `mapstructure:"BILLING_NCA_ID"`
	FunctionId                     string        `mapstructure:"FUNCTION_ID"`
	FunctionVersionId              string        `mapstructure:"FUNCTION_VERSION_ID"`
	FunctionName                   string        `mapstructure:"FUNCTION_NAME"`
	BaseAssetDir                   string        `mapstructure:"BASE_ASSET_DIR"`
	BaseResponseDir                string        `mapstructure:"BASE_RESPONSE_DIR"`
	HealthPort                     int           `mapstructure:"HEALTH_PORT"`
	CloudProvider                  string        `mapstructure:"CLOUD_PROVIDER"`
	CloudPlatform                  string        `mapstructure:"CLOUD_PLATFORM"`
	InstanceType                   string        `mapstructure:"INSTANCE_TYPE"`
	// SpotEnvironment is deprecated: use ICMSEnvironment (or set ICMS_ENVIRONMENT). If unset, ICMSEnvironment is set from this in setup.
	SpotEnvironment       string   `mapstructure:"SPOT_ENVIRONMENT"`
	ICMSEnvironment       string   `mapstructure:"ICMS_ENVIRONMENT"`
	ZoneName              string   `mapstructure:"ZONE_NAME"`
	GpuType               string   `mapstructure:"GPU_NAME"`
	GpuCount              int      `mapstructure:"ATTACHED_GPU_COUNT"`
	InstanceId            string   `mapstructure:"INSTANCE_ID"`
	MaxRequestConcurrency int      `mapstructure:"MAX_REQUEST_CONCURRENCY"`
	FunctionTags          []string `mapstructure:"FUNCTION_TAGS"` // csv
	EssAgentConfigDir     string   `mapstructure:"ESS_AGENT_CONFIG_DIR"`
	SecretsAssertionToken string   `mapstructure:"SECRETS_ASSERTION_TOKEN"`
	SharedConfigDir       string   `mapstructure:"SHARED_CONFIG_DIR"`
	// by default, compatibility mode is enabled
	V3BackwardsCompatibilityDisabled bool   `mapstructure:"V3_BACKWARDS_COMPATIBILITY_DISABLED"`
	InferenceServiceName             string `mapstructure:"INFERENCE_SERVICE_NAME"`
	InferenceNamespace               string `mapstructure:"INFERENCE_NAMESPACE"`
}

type ErrorBody

type ErrorBody struct {
	Error string `json:"error"`
}

type NVCFWorker

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

func NewNVCFWorker

func NewNVCFWorker(ctx context.Context, zapLogger *logs.ZapLogger, config Config) (*NVCFWorker, error)

func (*NVCFWorker) Run

func (w *NVCFWorker) Run(withHttpServer bool) error

Run withHttpServer argument is for testing

func (*NVCFWorker) Setup

func (w *NVCFWorker) Setup() error

func (*NVCFWorker) SetupWorkDirs

func (w *NVCFWorker) SetupWorkDirs() error

SetupWorkDirs is visible for testing

func (*NVCFWorker) Shutdown

func (w *NVCFWorker) Shutdown()

Shutdown triggers a graceful shutdown of the worker -- This is only used by tests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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