taskhandler

package
v0.0.0-...-0e5f22e Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricsHandler

func MetricsHandler(metricsHost string, metricsPath string, timeout int) http.Handler

MetricsHandler returns an http.Handler

Types

type ClusterConnection

type ClusterConnection struct {
	DiscoveryService DiscoveryService
	State            ClusterState
	// contains filtered or unexported fields
}

ClusterConnection represents a connection to a cluster, and contains information such as the cluster membership list

func NewClusterConnection

func NewClusterConnection(dService DiscoveryService) *ClusterConnection

NewClusterConnection creates a new ClusterConnection. It does not connect to the cluster before Connect() is called.

func (*ClusterConnection) Connect

func (cluster *ClusterConnection) Connect() error

Connect connects the current node to the cluster, that is, it registers the node and starts listening for memebership updates.

func (*ClusterConnection) Disconnect

func (cluster *ClusterConnection) Disconnect() error

Disconnect removes this node from the cluster. Notice that it is not necesarraily unregistered immediately, depending on the discovery service implementation.

func (*ClusterConnection) FindNodeForKey

func (cluster *ClusterConnection) FindNodeForKey(key string) ([]ServingService, error)

FindNodeForKey returns a node that can handle the model specified by the given key.

type ClusterState

type ClusterState int

ClusterState represents the current state of the node

const (
	// ClusterStateReady represents that the node is ready to connect to cluster
	ClusterStateReady ClusterState = iota
	// ClusterStateStarted represents that the node is connected to cluster
	ClusterStateStarted
)

func (*ClusterState) String

func (state *ClusterState) String() string

type DiscoveryService

type DiscoveryService interface {
	AddNodeListUpdated(string, chan []ServingService)
	RemoveNodeListUpdated(string)
	RegisterService() error
	UnregisterService() error
}

DiscoveryService is a service discovery provider. It has the responsibility to discover other ServingServices and to register itself on the network.

type ServingService

type ServingService struct {
	Host     string
	GrpcPort int
	RestPort int
}

ServingService contains network information of a service that provides TF Serving

func (*ServingService) String

func (service *ServingService) String() string

type TaskHandler

type TaskHandler struct {
	Cluster   *ClusterConnection
	RestProxy *tfservingproxy.RestProxy
	GrpcProxy *tfservingproxy.GrpcProxy
	// contains filtered or unexported fields
}

TaskHandler handles TFServing jobs. A TaskHandler is usually associated with one TFServing server, e.g. as a sidecar.

func NewTaskHandler

func NewTaskHandler(dService DiscoveryService) *TaskHandler

NewTaskHandler creates a new TaskHandler

func (*TaskHandler) Close

func (handler *TaskHandler) Close() error

func (*TaskHandler) ConnectToCluster

func (handler *TaskHandler) ConnectToCluster() error

ConnectToCluster makes this TaskHandler discoverable in the cluster and starts listening for other members

func (*TaskHandler) DisconnectFromCluster

func (handler *TaskHandler) DisconnectFromCluster() error

DisconnectFromCluster disconnects the TaskHandler from the cluster (eventually)

func (*TaskHandler) ServeRest

func (handler *TaskHandler) ServeRest() func(http.ResponseWriter, *http.Request)

ServeRest returns a function for HTTP serving

Directories

Path Synopsis
discovery

Jump to

Keyboard shortcuts

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