{"modulePath":"github.com/flyteorg/flyte/v2","version":"v2.0.57","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugin\n\n## Constants\n\n```go\nconst (\n\tRunLabel      = flytek8s.RunLabel\n\tActionLabel   = flytek8s.ActionLabel\n\tAttemptLabel  = flytek8s.AttemptLabel\n\tTaskNameLabel = flytek8s.TaskNameLabel\n)\n```\nLabels stamped on task pods so external per-pod metrics (DCGM, cAdvisor, kube-state-metrics) can be joined back to Flyte semantics, and so the framework can find the pods belonging to one attempt of one action. They are defined in flytek8s alongside the managed label, because the plugins that build pod templates have to keep them intact for the pods an operator derives from those templates to carry them.\n\n## Functions\n\n```go\nfunc ComputeActionOutputPath(ctx context.Context, namespace, name, runOutputBase, actionName string, attempt uint32) (storage.DataReference, error)\n```\n\n```go\nfunc ComputeActionRawOutputPath(ctx context.Context, taskAction *flyteorgv1.TaskAction, attempt uint32, outputPrefix storage.DataReference) (storage.DataReference, error)\n```\nComputeActionOutputPath constructs the full output directory for a task action:\n\n\t\u003cscheme\u003e://\u003cbucket\u003e/\u003cshard\u003e/\u003crest-of-runOutputBase\u003e/\u003cactionName\u003e/\u003cattempt\u003e\n\nThe shard is a 2-char base-36 prefix derived deterministically from the TaskAction's namespace and name. It is inserted immediately after the bucket (AWS S3 hot-spot avoidance convention) so that storage traffic is spread across key prefixes from the root. The attempt segment isolates each retry. ComputeActionRawOutputPath returns where the action writes raw data: under Spec.RawDataPrefix when set, laid out like the output path, else outputPrefix.\n\n```go\nfunc NewNoopResourceManager() pluginsCore.ResourceManager\n```\nNewNoopResourceManager returns a ResourceManager that grants every allocation.\n\n```go\nfunc NewNoopResourceRegistrar() pluginsCore.ResourceRegistrar\n```\nNewNoopResourceRegistrar returns a ResourceRegistrar that accepts quota declarations without enforcing them.\n\n```go\nfunc NewNoopSecretManager() pluginsCore.SecretManager\n```\nNewNoopSecretManager returns a SecretManager with no backend that fails every lookup with a clear error, so a connector task referencing a secret does not silently receive an empty value.\n\n```go\nfunc NewSetupContext(\n\tkubeClient pluginsCore.KubeClient,\n\tsecretManager pluginsCore.SecretManager,\n\tresourceRegistrar pluginsCore.ResourceRegistrar,\n\tenqueueOwner pluginsCore.EnqueueOwner,\n\tenqueueLabels []string,\n\townerKind string,\n\tmetricsScope promutils.Scope,\n) pluginsCore.SetupContext\n```\nNewSetupContext creates a SetupContext implementation for the executor.\n\n```go\nfunc NewTaskExecutionContext(\n\ttaskAction *flyteorgv1.TaskAction,\n\tdataStore *storage.DataStore,\n\tpluginStateMgr *PluginStateManager,\n\tsecretManager pluginsCore.SecretManager,\n\tresourceManager pluginsCore.ResourceManager,\n\tcatalogClient catalog.AsyncClient,\n) (*taskExecutionContext, error)\n```\nNewTaskExecutionContext creates a TaskExecutionContext from a TaskAction and supporting dependencies.\n\n```go\nfunc NewTaskExecutionMetadata(ta *flyteorgv1.TaskAction) (pluginsCore.TaskExecutionMetadata, error)\n```\nNewTaskExecutionMetadata creates a TaskExecutionMetadata from a TaskAction.\n\n## Types\n\n```go\ntype PluginRegistryIface interface {\n\tGetCorePlugins() []pluginsCore.PluginEntry\n\tGetK8sPlugins() []k8sPlugin.PluginEntry\n}\n```\nPluginRegistryIface provides access to registered plugin entries.\n\n```go\ntype PluginStateManager struct {\n\t// contains filtered or unexported fields\n}\n```\nPluginStateManager implements PluginStateReader and PluginStateWriter using Gob encoding over byte buffers. It is initialized with the previous state from TaskAction.Status.PluginState and captures new state written by the plugin during Handle.\n\n```go\nfunc NewPluginStateManager(prevState []byte, prevVersion uint8) *PluginStateManager\n```\nNewPluginStateManager creates a PluginStateManager initialized with the previous round's state.\n\n```go\nfunc (m *PluginStateManager) Get(t interface{}) (uint8, error)\n```\nGet deserializes the previous state into t using Gob decoding. If there is no previous state, t remains its zero value and version 0 is returned.\n\n```go\nfunc (m *PluginStateManager) GetNewState() (stateBytes []byte, version uint8, written bool)\n```\nGetNewState returns the new state bytes, version, and whether state was written during this round. The controller uses this to persist the state back to TaskAction.Status.\n\n```go\nfunc (m *PluginStateManager) GetStateVersion() uint8\n```\nGetStateVersion returns the version of the previous state.\n\n```go\nfunc (m *PluginStateManager) Put(stateVersion uint8, v interface{}) error\n```\nPut serializes v using Gob encoding and stores it as the new state. Only the last call to Put is recorded; all previous calls are overwritten.\n\n```go\nfunc (m *PluginStateManager) Reset() error\n```\nReset clears the state to empty.\n\n```go\ntype Registry struct {\n\t// contains filtered or unexported fields\n}\n```\nRegistry resolves a pluginsCore.Plugin for a given task type by wrapping the global plugin registry. K8s plugins are wrapped in a PluginManager; core plugins are loaded via their PluginLoader.\n\n```go\nfunc NewRegistry(setupCtx pluginsCore.SetupContext, pluginRegistry PluginRegistryIface) *Registry\n```\nNewRegistry creates a Registry backed by the given plugin source and setup context.\n\n```go\nfunc (r *Registry) Initialize(ctx context.Context) error\n```\nInitialize loads all registered plugins. Must be called once during startup.\n\n```go\nfunc (r *Registry) ResolvePlugin(taskType string) (pluginsCore.Plugin, error)\n```\nResolvePlugin returns the plugin registered for the given task type. Falls back to the default plugin if no specific match is found.\n\n","path":"github.com/flyteorg/flyte/v2/executor/pkg/plugin","name":"plugin","synopsis":"","isRedistributable":true}
