serving

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ExampleOutputDir = "cog-example-output"

TODO(andreas): put this somewhere else since it's used by server?

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment interface {
	RunPrediction(ctx context.Context, input *Example, logWriter logger.Logger) (*Result, error)
	Help(ctx context.Context, logWriter logger.Logger) (*HelpResponse, error)
	Undeploy() error
}

type Example

type Example struct {
	Values map[string]ExampleValue
}

func NewExample

func NewExample(keyVals map[string]string) *Example

func NewExampleWithBaseDir

func NewExampleWithBaseDir(keyVals map[string]string, baseDir string) *Example

type ExampleValue

type ExampleValue struct {
	String *string
	File   *string
}

type HelpResponse

type HelpResponse struct {
	Arguments map[string]*model.RunArgument `json:"arguments"`
}

type LocalDockerDeployment

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

func (*LocalDockerDeployment) Help

func (d *LocalDockerDeployment) Help(ctx context.Context, logWriter logger.Logger) (*HelpResponse, error)

func (*LocalDockerDeployment) RunPrediction

func (d *LocalDockerDeployment) RunPrediction(ctx context.Context, input *Example, logWriter logger.Logger) (*Result, error)

func (*LocalDockerDeployment) Undeploy

func (d *LocalDockerDeployment) Undeploy() error

type LocalDockerPlatform

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

func NewLocalDockerPlatform

func NewLocalDockerPlatform() (*LocalDockerPlatform, error)

func (*LocalDockerPlatform) Deploy

func (p *LocalDockerPlatform) Deploy(ctx context.Context, imageTag string, useGPU bool, logWriter logger.Logger) (Deployment, error)

type MockRunFunc

type MockRunFunc func(*Example) *Result

type MockServingDeployment

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

func (*MockServingDeployment) Help

func (d *MockServingDeployment) Help(ctx context.Context, logWriter logger.Logger) (*HelpResponse, error)

func (*MockServingDeployment) RunPrediction

func (d *MockServingDeployment) RunPrediction(ctx context.Context, input *Example, logWriter logger.Logger) (*Result, error)

func (*MockServingDeployment) Undeploy

func (d *MockServingDeployment) Undeploy() error

type MockServingPlatform

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

func NewMockServingPlatform

func NewMockServingPlatform(bootDuration time.Duration, run MockRunFunc, helpArguments map[string]*model.RunArgument) *MockServingPlatform

func (*MockServingPlatform) Deploy

func (m *MockServingPlatform) Deploy(ctx context.Context, imageTag string, useGPU bool, logWriter logger.Logger) (Deployment, error)

type Platform

type Platform interface {
	Deploy(ctx context.Context, imageTag string, useGPU bool, logWriter logger.Logger) (Deployment, error)
}

type Result

type Result struct {
	Values          map[string]ResultValue
	SetupTime       float64
	RunTime         float64
	UsedMemoryBytes uint64
	UsedCPUSecs     float64
}

type ResultValue

type ResultValue struct {
	Buffer   io.Reader
	MimeType string
}

type TestResult

type TestResult struct {
	RunArgs           map[string]*model.RunArgument
	Examples          []*model.Example
	NewExampleOutputs map[string][]byte // map of paths (e.g. "cog-example-output/output.01.png") to contents
	Stats             *model.Stats
}

func TestVersion

func TestVersion(ctx context.Context, servingPlatform Platform, imageTag string, examples []*model.Example, dir string, useGPU bool, logWriter logger.Logger) (*TestResult, error)

TestVersion runs the example inputs and checks the example outputs. If examples inputs are defined but example outputs aren't, defined, the resulting outputs are written to exampleOutputDir and the examples object is updated to point to those outputs.

Jump to

Keyboard shortcuts

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