vizier

package
v0.0.0-...-1bd9ace Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const FormatInMemory string = "inmemory"

FormatInMemory denotes the inmemory format.

Variables

View Source
var (
	// ErrMetadataMissing is returned when table was malformed missing data.
	ErrMetadataMissing = errors.New("metadata missing for table")
	// ErrDuplicateMetadata is returned when table is malformed an contains multiple metadata.
	ErrDuplicateMetadata = errors.New("duplicate table metadata received")
)

Functions

func FindOperatorNamespace

func FindOperatorNamespace(clientset *kubernetes.Clientset) (string, error)

FindOperatorNamespace finds the namespace running the vizier-operator.

func FindVizierNamespace

func FindVizierNamespace(clientset *kubernetes.Clientset) (string, error)

FindVizierNamespace looks for the namespace that the vizier is running in for the current context.

func FirstHealthyVizier

func FirstHealthyVizier(cloudAddr string) (uuid.UUID, error)

FirstHealthyVizier returns the cluster ID of the first healthy vizier.

func FormatErrorMessage

func FormatErrorMessage(err error) string

FormatErrorMessage converts Vizier error messages into stylized strings.

func GetCloudAddrFromKubeConfig

func GetCloudAddrFromKubeConfig(config *rest.Config) string

GetCloudAddrFromKubeConfig returns the cloud address given the kubeconfig. If anything fails, then will return an empty string.

func GetClusterIDFromKubeConfig

func GetClusterIDFromKubeConfig(config *rest.Config) uuid.UUID

GetClusterIDFromKubeConfig returns the clusterID given the kubeconfig. If anything fails, then will return a nil UUID.

func GetCurrentOrFirstHealthyVizier

func GetCurrentOrFirstHealthyVizier(cloudAddr string) (uuid.UUID, error)

GetCurrentOrFirstHealthyVizier tries to get the vizier from the current context. If unavailable, it gets the ID of the first healthy Vizier.

func GetCurrentVizier

func GetCurrentVizier(cloudAddr string) (uuid.UUID, error)

GetCurrentVizier tries to get the ID of the current Vizier, even if it is unhealthy.

func GetFuncsToExecute

GetFuncsToExecute extracts the funcs to execute from the script.

func GetVizierInfo

func GetVizierInfo(cloudAddr string, clusterID uuid.UUID) (*cloudpb.ClusterInfo, error)

GetVizierInfo returns the info about the vizier running on the specified cluster, if it exists.

func GetVizierList

func GetVizierList(cloudAddr string) ([]*cloudpb.ClusterInfo, error)

GetVizierList gets a list of all viziers.

func MustFindVizierNamespace

func MustFindVizierNamespace() string

MustFindVizierNamespace exits the current program if a Vizier namespace can't be found.

func RunScript

func RunScript(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, encOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) (chan *ExecData, error)

RunScript runs the script and return the data channel

func RunScriptAndOutputResults

func RunScriptAndOutputResults(ctx context.Context, conns []*Connector, execScript *script.ExecutableScript, format string, useEncryption bool) error

RunScriptAndOutputResults runs the specified script on vizier and outputs based on format string.

Types

type Connector

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

Connector is an interface to Vizier.

func ConnectHealthyDefaultVizier

func ConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) ([]*Connector, error)

ConnectHealthyDefaultVizier connects to the healthy default vizier based on parameters.

func ConnectToAllViziers

func ConnectToAllViziers(cloudAddr string) ([]*Connector, error)

ConnectToAllViziers connects to all available viziers.

func ConnectionToHealthyVizierByID

func ConnectionToHealthyVizierByID(cloudAddr string, clusterID uuid.UUID) (*Connector, error)

ConnectionToHealthyVizierByID connects to the input clusterID if it is healthy. It returns an error if the clusterID provided corresponds to a cluster that is not healthy.

func ConnectionToVizierByID

func ConnectionToVizierByID(cloudAddr string, clusterID uuid.UUID) (*Connector, error)

ConnectionToVizierByID connects to the vizier on specified ID. It will not check for Vizier health.

func MustConnectHealthyDefaultVizier

func MustConnectHealthyDefaultVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID) []*Connector

MustConnectHealthyDefaultVizier vizier will connect to default vizier based on parameters.

func MustConnectVizier

func MustConnectVizier(cloudAddr string, allClusters bool, clusterID uuid.UUID, directVzAddr string, directKey string) []*Connector

MustConnectVizier will connect to Pixie cloud or directly to a vizier service.

func NewConnector

func NewConnector(cloudAddr string, vzInfo *cloudpb.ClusterInfo, directVzAddr string, directVzKey string) (*Connector, error)

NewConnector returns a new connector.

func (*Connector) DebugLogRequest

func (c *Connector) DebugLogRequest(ctx context.Context, podName string, prev bool, container string) (chan *DebugLogResponse, error)

DebugLogRequest sends a debug log request and returns data in a chan.

func (*Connector) DebugPodsRequest

func (c *Connector) DebugPodsRequest(ctx context.Context) (chan *DebugPodsResponse, error)

DebugPodsRequest sends a debug pods request and returns data in a chan.

func (*Connector) ExecuteScriptStream

func (c *Connector) ExecuteScriptStream(ctx context.Context, script *script.ExecutableScript, encOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) (chan *ExecData, error)

ExecuteScriptStream execute a vizier query as a stream.

type DataFormatter

type DataFormatter interface {
	// FormatValue formats the value for a particular column.
	FormatValue(colIdx int, val interface{}) interface{}
}

DataFormatter formats data for a given Relation.

func NewDataFormatterForTable

func NewDataFormatterForTable(relation *vizierpb.Relation) DataFormatter

NewDataFormatterForTable creates a new data formatter based on the input relation.

type DebugLogResponse

type DebugLogResponse struct {
	Data string
	Err  error
}

DebugLogResponse contains information about debug logs.

type DebugPodsResponse

type DebugPodsResponse struct {
	ControlPlanePods []*vizierpb.VizierPodStatus
	DataPlanePods    []*vizierpb.VizierPodStatus
	Err              error
}

DebugPodsResponse contains information about debug logs.

type ErrorCode

type ErrorCode int

ErrorCode is the base type for vizier error codes.

const (
	// CodeUnknown is placeholder for unknown errors.
	CodeUnknown ErrorCode = iota
	// CodeTimeout is for execution timeouts.
	CodeTimeout
	// CodeBadData occurs when bad data/format is received from vizier.
	CodeBadData
	// CodeGRPCError is used for GRPC errors.
	CodeGRPCError
	// CodeCompilerError is used for compilations errors.
	CodeCompilerError
	// CodeCanceled is used for script cancellation.
	CodeCanceled
)

func GetErrorCode

func GetErrorCode(err error) ErrorCode

GetErrorCode gets the error code for vizier errors.

type ExecData

type ExecData struct {
	Resp      *vizierpb.ExecuteScriptResponse
	ClusterID uuid.UUID
	Err       error
}

ExecData contains information from script executions.

type Lister

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

Lister allows fetching information about Viziers from the cloud.

func NewLister

func NewLister(cloudAddr string) (*Lister, error)

NewLister returns a Lister.

func (*Lister) GetVizierInfo

func (l *Lister) GetVizierInfo(id uuid.UUID) ([]*cloudpb.ClusterInfo, error)

GetVizierInfo returns information about a connected vizier.

func (*Lister) GetViziersInfo

func (l *Lister) GetViziersInfo() ([]*cloudpb.ClusterInfo, error)

GetViziersInfo returns information about connected viziers.

type ScriptExecutionError

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

ScriptExecutionError occurs for errors during script execution on vizier.

func (*ScriptExecutionError) Code

func (s *ScriptExecutionError) Code() ErrorCode

Code returns the error code.

func (*ScriptExecutionError) CompilerErrors

func (s *ScriptExecutionError) CompilerErrors() []string

CompilerErrors returns compiler errors as strings if any.

func (*ScriptExecutionError) Error

func (s *ScriptExecutionError) Error() string

Error returns the errors message.

type StreamOutputAdapter

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

StreamOutputAdapter adapts the vizier output to the StreamWriters.

func NewStreamOutputAdapter

func NewStreamOutputAdapter(ctx context.Context, stream chan *ExecData, format string, decOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions) *StreamOutputAdapter

NewStreamOutputAdapter creates a new vizier output adapter.

func NewStreamOutputAdapterWithFactory

func NewStreamOutputAdapterWithFactory(ctx context.Context, stream chan *ExecData, format string,
	decOpts *vizierpb.ExecuteScriptRequest_EncryptionOptions,
	factoryFunc func(*vizierpb.ExecuteScriptResponse_MetaData) components.OutputStreamWriter) *StreamOutputAdapter

NewStreamOutputAdapterWithFactory creates a new vizier output adapter factory.

func (*StreamOutputAdapter) ExecStats

ExecStats returns the reported execution stats. This function is only valid with format = inmemory and after Finish.

func (*StreamOutputAdapter) Finish

func (v *StreamOutputAdapter) Finish() error

Finish must be called to wait for the output and flush all the data.

func (*StreamOutputAdapter) Formatters

func (v *StreamOutputAdapter) Formatters() ([]DataFormatter, error)

Formatters gets all the data formatters. This function is only valid with format = inmemory and after Finish.

func (*StreamOutputAdapter) MutationInfo

func (v *StreamOutputAdapter) MutationInfo() (*vizierpb.MutationInfo, error)

MutationInfo returns the mutation info. This function is only valid after Finish.

func (*StreamOutputAdapter) TotalBytes

func (v *StreamOutputAdapter) TotalBytes() int

TotalBytes returns the total bytes of messages passed to this adapter.

func (*StreamOutputAdapter) Views

Views gets all the accumulated views. This function is only valid with format = inmemory and after Finish.

func (*StreamOutputAdapter) WaitForCompletion

func (v *StreamOutputAdapter) WaitForCompletion() error

WaitForCompletion waits for the stream to complete, but does not flush the data.

type StreamWriterFactorFunc

type StreamWriterFactorFunc = func(md *vizierpb.ExecuteScriptResponse_MetaData) components.OutputStreamWriter

StreamWriterFactorFunc is a stream writer factory.

type TableInfo

type TableInfo struct {
	ID string
	// contains filtered or unexported fields
}

TableInfo contains the information about a table.

Jump to

Keyboard shortcuts

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