example

package
Version: v0.5.28 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrRemoteSystem errors.ErrorCode = "RemoteSystem"
	ErrRemoteUser   errors.ErrorCode = "RemoteUser"
	ErrSystem       errors.ErrorCode = "System"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Contains the default configs needed for the webapi base implementation.
	WebAPI              webapi.PluginConfig          `json:"webApi" pflag:",Defines config for the base WebAPI plugin."`
	ResourceConstraints core.ResourceConstraintsSpec `` /* 141-byte string literal not displayed */
}

The config object for this plugin.

func GetConfig

func GetConfig() *Config

func (Config) GetPFlagSet

func (cfg Config) GetPFlagSet(prefix string) *pflag.FlagSet

GetPFlagSet will return strongly types pflags for all fields in Config and its nested types. The format of the flags is json-name.json-sub-name... etc.

type Plugin

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

func NewPlugin

func NewPlugin(ctx context.Context, cfg *Config, metricScope promutils.Scope) (Plugin, error)

func (Plugin) Create

func (p Plugin) Create(ctx context.Context, tCtx webapi.TaskExecutionContextReader) (resourceMeta webapi.ResourceMeta,
	resource webapi.Resource, err error)

func (Plugin) Delete

func (p Plugin) Delete(ctx context.Context, tCtx webapi.DeleteContext) error

Delete the object in the remote service using the resource key. Flyte will call this API at least once. If the resource has already been deleted, the API should not fail.

func (Plugin) Get

func (p Plugin) Get(ctx context.Context, tCtx webapi.GetContext) (latest webapi.Resource, err error)

Get the resource that matches the keys. If the plugin hits any failure, it should stop and return the failure. This API will be called asynchronously and periodically to update the set of tasks currently in progress. It's acceptable if this API is blocking since it'll be called from a background go-routine. Best practices:

1) Instead of returning the entire response object retrieved from the WebAPI, construct a smaller object that
   has enough information to construct the status/phase, error and/or output.
2) This object will NOT be serialized/marshaled. It's, therefore, not a requirement to make it so.
3) There is already client-side throttling in place. If the WebAPI returns a throttling error, you should return
   it as is so that the appropriate metrics are updated and the system administrator can update throttling
   params accordingly.

func (Plugin) GetConfig

func (p Plugin) GetConfig() webapi.PluginConfig

func (Plugin) ResourceRequirements

func (p Plugin) ResourceRequirements(_ context.Context, _ webapi.TaskExecutionContextReader) (
	namespace core.ResourceNamespace, constraints core.ResourceConstraintsSpec, err error)

func (Plugin) Status

func (p Plugin) Status(ctx context.Context, tCtx webapi.StatusContext) (phase core.PhaseInfo, 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.

Jump to

Keyboard shortcuts

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