webapi

package
v2.0.16 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BadReturnCodeError stdErrors.ErrorCode = "RETURNED_UNKNOWN"
)

Variables

This section is empty.

Functions

func CreateRemotePlugin

func CreateRemotePlugin(pluginEntry webapi.PluginEntry) core.PluginEntry

func ToPluginPhase

func ToPluginPhase(s core.Phase) (webapi.Phase, error)

ToPluginPhase translates the more granular task phase into the webapi plugin phase.

Types

type CacheItem

type CacheItem struct {
	webapi.State
	Resource webapi.Resource
}

A wrapper for each item in the cache.

func (CacheItem) IsTerminal

func (c CacheItem) IsTerminal() bool

type Client

type Client interface {
	// Get multiple resources that match all the keys. If the plugin hits any failure, it should stop and return
	// the failure. This batch will not be processed further.
	Get(ctx context.Context, tCtx webapi.GetContext) (latest webapi.Resource, err error)

	// Status checks the status of a given resource and translates it to a Flyte-understandable PhaseInfo. This API
	// should avoid making any network calls and should run very efficiently.
	Status(ctx context.Context, tCtx webapi.StatusContext) (phase core.PhaseInfo, err error)
}

Client interface needed for resource cache to fetch latest updates for resources.

type CorePlugin

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

func (CorePlugin) Abort

func (CorePlugin) Finalize

func (c CorePlugin) Finalize(ctx context.Context, tCtx core.TaskExecutionContext) error

func (CorePlugin) GetID

func (c CorePlugin) GetID() string

func (CorePlugin) GetProperties

func (c CorePlugin) GetProperties() core.PluginProperties

func (CorePlugin) Handle

type Metrics

type Metrics struct {
	Scope                   promutils.Scope
	ResourceReleased        labeled.Counter
	ResourceReleaseFailed   labeled.Counter
	AllocationGranted       labeled.Counter
	AllocationNotGranted    labeled.Counter
	ResourceWaitTime        prometheus.Summary
	SucceededUnmarshalState labeled.StopWatch
	FailedUnmarshalState    labeled.Counter
}

type ResourceCache

type ResourceCache struct {
	// AutoRefresh
	autorefreshcache.AutoRefresh
	// contains filtered or unexported fields
}

A generic AutoRefresh cache that uses a client to fetch items' status.

func NewResourceCache

func NewResourceCache(ctx context.Context, name string, client Client, cfg webapi.CachingConfig,
	rateCfg webapi.RateLimiterConfig,
	scope promutils.Scope) (ResourceCache, error)

func (*ResourceCache) SyncResource

func (q *ResourceCache) SyncResource(ctx context.Context, batch autorefreshcache.Batch) (
	updatedBatch []autorefreshcache.ItemSyncResponse, err error)

This basically grab an updated status from Client and store it in the cache All other handling should be in the synchronous loop.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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