handlers

package
v0.0.0-...-93913ae Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorArray

func ErrorArray(errors []error) []string

ErrorArray returns human readable error messages.

func GetRequestPayload

func GetRequestPayload(requestBody io.ReadCloser) []byte

GetRequestPayload get request body's payload.

func HandlerError

func HandlerError(w http.ResponseWriter, errs []error, status int)

HandlerError http error handler.

func HandlerPOST

func HandlerPOST(w http.ResponseWriter, r *http.Request, p *Processor)

HandlerPOST http handler to invoke train pipeline.

func HandlerStatus

func HandlerStatus(w http.ResponseWriter, r *http.Request)

HandlerStatus http status handler.

func MustMarshal

func MustMarshal(obj interface{}) []byte

MustMarshal performs json.Marshal

func Validate

func Validate(schema string, data []byte) error

Validate validates byte data against json schema.

Types

type Error

type Error struct {
	// Type defines the error type.
	Type string
	// Message defines human readable error message.
	Message string
	// Details defines details of the error.
	Details interface{}
}

Error defines the error.

func (Error) Error

func (e Error) Error() string

Error returns a human readable error message.

type ErrorPush

type ErrorPush struct {
	// contains error message
	Message string `json:"message"`
	// contains pipeline config
	Details interface{} `json:"details"`
}

ErrorPush defines the errors of submitting jobs.

func (ErrorPush) Error

func (e ErrorPush) Error() string

Error returns a human readable error message.

type Input

type Input struct {
	// Model project ID (there may be several model projects within one cloud project).
	ProjectID string `json:"project_id"`
	// CodeHash is the model codebase ID.
	CodeHash string `json:"code_hash,omitempty"`
	// TrainID is the experiment's ID.
	TrainID string `json:"train_id,omitempty"`
	// Config is the ML pipeline config
	Config []interface{} `json:"pipeline_config"`
}

Input defines the input payload to invoke pipeline.

type OutputDistribution

type OutputDistribution struct {
	// Topic is the message broker topic to push payload to.
	Topic string
}

OutputDistribution defines the output distribution config.

type OutputPayload

type OutputPayload struct {
	Errors      []string `json:"errors"`
	SubmittedID []string `json:"submitted_id"`
}

OutputPayload defines output payload.

type Processor

type Processor struct {
	// Type defines the execution type, either train, or predict
	Type string
	// TopicPrefix represents prefix of the topic to post the payload to.
	TopicPrefix string
	// InputJSONSchema defines the jsonschema of the input payload.
	InputJSONSchema string
	// Message bus to disctribute messages
	Bus *bus.Client
}

Processor defines processor for predict pipeline.

func (*Processor) Exec

func (p *Processor) Exec(data []byte) (*OutputPayload, error)

Exec run processor sequence.

Jump to

Keyboard shortcuts

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