events

package
v0.0.0-...-9317174 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 28 Imported by: 10

Documentation

Overview

Package events contains code for writing task events to various systems.

Index

Constants

View Source
const (
	EventService_WriteEvent_FullMethodName = "/events.EventService/WriteEvent"
)

Variables

View Source
var (
	Type_name = map[int32]string{
		0:  "UNKNOWN",
		1:  "TASK_STATE",
		2:  "TASK_START_TIME",
		3:  "TASK_END_TIME",
		4:  "TASK_OUTPUTS",
		5:  "TASK_METADATA",
		6:  "EXECUTOR_START_TIME",
		7:  "EXECUTOR_END_TIME",
		8:  "EXECUTOR_EXIT_CODE",
		11: "EXECUTOR_STDOUT",
		12: "EXECUTOR_STDERR",
		13: "SYSTEM_LOG",
		14: "TASK_CREATED",
	}
	Type_value = map[string]int32{
		"UNKNOWN":             0,
		"TASK_STATE":          1,
		"TASK_START_TIME":     2,
		"TASK_END_TIME":       3,
		"TASK_OUTPUTS":        4,
		"TASK_METADATA":       5,
		"EXECUTOR_START_TIME": 6,
		"EXECUTOR_END_TIME":   7,
		"EXECUTOR_EXIT_CODE":  8,
		"EXECUTOR_STDOUT":     11,
		"EXECUTOR_STDERR":     12,
		"SYSTEM_LOG":          13,
		"TASK_CREATED":        14,
	}
)

Enum value maps for Type.

View Source
var EventService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "events.EventService",
	HandlerType: (*EventServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "WriteEvent",
			Handler:    _EventService_WriteEvent_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "events.proto",
}

EventService_ServiceDesc is the grpc.ServiceDesc for EventService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_events_proto protoreflect.FileDescriptor
View Source
var Marshaler = &jsonpb.Marshaler{
	EnumsAsInts:  false,
	EmitDefaults: false,
	Indent:       "\t",
}

Marshaler provides a default JSON marshaler.

Functions

func LogTail

func LogTail(ctx context.Context, taskID string, attempt, index uint32, size int64, out Writer) (stdout, stderr io.Writer)

LogTail returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events once the ctx.Done is closed.

func Marshal

func Marshal(ev *Event) (string, error)

Marshal marshals the event to JSON.

func ReadPubSub

func ReadPubSub(ctx context.Context, conf config.PubSub, subname string, w Writer) error

ReadPubSub reads events from the topic configured by "conf". The subscription "subname" will be created if it doesn't exist. This blocks until the context is canceled.

func RegisterEventServiceServer

func RegisterEventServiceServer(s grpc.ServiceRegistrar, srv EventServiceServer)

func StreamLogTail

func StreamLogTail(ctx context.Context, taskID string, attempt, index uint32, size int64, interval time.Duration, out Writer, wg *sync.WaitGroup) (stdout, stderr io.Writer)

StreamLogTail returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events. Events are rate limited by "interval", e.g. a max of one event every 5 seconds.

func Unmarshal

func Unmarshal(b []byte, ev *Event) error

Unmarshal unmarshals the event from JSON.

Types

type Backend

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

func (Backend) CheckBackendParameterSupport

func (b Backend) CheckBackendParameterSupport(task *tes.Task) error

func (Backend) Close

func (b Backend) Close()

func (Backend) WriteEvent

func (b Backend) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent does nothing and returns nil.

type Computer

type Computer interface {
	Writer
	CheckBackendParameterSupport(task *tes.Task) error
}

type ErrLogger

type ErrLogger struct {
	Writer
	Log *logger.Logger
}

ErrLogger writes an error message to the given logger when an event write fails.

func (*ErrLogger) WriteEvent

func (e *ErrLogger) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes the event to the underlying event writer. If an error is returned from that write, ErrLogger will log the error to the give logger, and return the error.

type Event

type Event struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Timestamp string `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Types that are assignable to Data:
	//
	//	*Event_State
	//	*Event_StartTime
	//	*Event_EndTime
	//	*Event_Outputs
	//	*Event_Metadata
	//	*Event_ExitCode
	//	*Event_Stdout
	//	*Event_Stderr
	//	*Event_SystemLog
	//	*Event_Task
	Data    isEvent_Data `protobuf_oneof:"data"`
	Attempt uint32       `protobuf:"varint,16,opt,name=attempt,proto3" json:"attempt,omitempty"`
	Index   uint32       `protobuf:"varint,17,opt,name=index,proto3" json:"index,omitempty"`
	Type    Type         `protobuf:"varint,18,opt,name=type,proto3,enum=events.Type" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func NewEndTime

func NewEndTime(taskID string, attempt uint32, t time.Time) *Event

NewEndTime creates a task end time event.

func NewExecutorEndTime

func NewExecutorEndTime(taskID string, attempt uint32, index uint32, t time.Time) *Event

NewExecutorEndTime creates an executor end time event. for the executor at the given index.

func NewExecutorStartTime

func NewExecutorStartTime(taskID string, attempt uint32, index uint32, t time.Time) *Event

NewExecutorStartTime creates an executor start time event for the executor at the given index.

func NewExitCode

func NewExitCode(taskID string, attempt uint32, index uint32, x int32) *Event

NewExitCode creates an executor exit code event for the executor at the given index.

func NewMetadata

func NewMetadata(taskID string, attempt uint32, m map[string]string) *Event

NewMetadata creates a task metadata log event.

func NewOutputs

func NewOutputs(taskID string, attempt uint32, f []*tes.OutputFileLog) *Event

NewOutputs creates a task output file log event.

func NewStartTime

func NewStartTime(taskID string, attempt uint32, t time.Time) *Event

NewStartTime creates a task start time event.

func NewState

func NewState(taskID string, s tes.State) *Event

NewState creates a state change event.

func NewStderr

func NewStderr(taskID string, attempt uint32, index uint32, s string) *Event

NewStderr creates an executor stderr chunk event for the executor at the given index.

func NewStdout

func NewStdout(taskID string, attempt uint32, index uint32, s string) *Event

NewStdout creates an executor stdout chunk event for the executor at the given index.

func NewSystemLog

func NewSystemLog(taskID string, attempt uint32, index uint32, lvl string, msg string, fields map[string]string) *Event

NewSystemLog creates an system log event.

func NewTaskCreated

func NewTaskCreated(task *tes.Task) *Event

NewTaskCreated creates a state change event.

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetAttempt

func (x *Event) GetAttempt() uint32

func (*Event) GetData

func (m *Event) GetData() isEvent_Data

func (*Event) GetEndTime

func (x *Event) GetEndTime() string

func (*Event) GetExitCode

func (x *Event) GetExitCode() int32

func (*Event) GetId

func (x *Event) GetId() string

func (*Event) GetIndex

func (x *Event) GetIndex() uint32

func (*Event) GetMetadata

func (x *Event) GetMetadata() *Metadata

func (*Event) GetOutputs

func (x *Event) GetOutputs() *Outputs

func (*Event) GetStartTime

func (x *Event) GetStartTime() string

func (*Event) GetState

func (x *Event) GetState() tes.State

func (*Event) GetStderr

func (x *Event) GetStderr() string

func (*Event) GetStdout

func (x *Event) GetStdout() string

func (*Event) GetSystemLog

func (x *Event) GetSystemLog() *SystemLog

func (*Event) GetTask

func (x *Event) GetTask() *tes.Task

func (*Event) GetTimestamp

func (x *Event) GetTimestamp() string

func (*Event) GetType

func (x *Event) GetType() Type

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

func (*Event) SysLogString

func (s *Event) SysLogString() string

SysLogString returns a flattened string representation of the SystemLog event

type EventServiceClient

type EventServiceClient interface {
	WriteEvent(ctx context.Context, in *Event, opts ...grpc.CallOption) (*WriteEventResponse, error)
}

EventServiceClient is the client API for EventService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type EventServiceServer

type EventServiceServer interface {
	WriteEvent(context.Context, *Event) (*WriteEventResponse, error)
	// contains filtered or unexported methods
}

EventServiceServer is the server API for EventService service. All implementations must embed UnimplementedEventServiceServer for forward compatibility

type Event_EndTime

type Event_EndTime struct {
	EndTime string `protobuf:"bytes,5,opt,name=end_time,json=endTime,proto3,oneof"`
}

type Event_ExitCode

type Event_ExitCode struct {
	ExitCode int32 `protobuf:"varint,10,opt,name=exit_code,json=exitCode,proto3,oneof"`
}

type Event_Metadata

type Event_Metadata struct {
	Metadata *Metadata `protobuf:"bytes,7,opt,name=metadata,proto3,oneof"`
}

type Event_Outputs

type Event_Outputs struct {
	Outputs *Outputs `protobuf:"bytes,6,opt,name=outputs,proto3,oneof"`
}

type Event_StartTime

type Event_StartTime struct {
	StartTime string `protobuf:"bytes,4,opt,name=start_time,json=startTime,proto3,oneof"`
}

type Event_State

type Event_State struct {
	State tes.State `protobuf:"varint,3,opt,name=state,proto3,enum=tes.State,oneof"`
}

type Event_Stderr

type Event_Stderr struct {
	Stderr string `protobuf:"bytes,14,opt,name=stderr,proto3,oneof"`
}

type Event_Stdout

type Event_Stdout struct {
	Stdout string `protobuf:"bytes,13,opt,name=stdout,proto3,oneof"`
}

type Event_SystemLog

type Event_SystemLog struct {
	SystemLog *SystemLog `protobuf:"bytes,15,opt,name=system_log,json=systemLog,proto3,oneof"`
}

type Event_Task

type Event_Task struct {
	Task *tes.Task `protobuf:"bytes,19,opt,name=task,proto3,oneof"`
}

type ExecutorGenerator

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

ExecutorGenerator is a type that generates Events for an Executor of a Task

func NewExecutorGenerator

func NewExecutorGenerator(taskID string, attempt uint32, index uint32) *ExecutorGenerator

NewExecutorGenerator returns a ExecutorGenerator instance.

func (*ExecutorGenerator) Debug

func (eg *ExecutorGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates a debug level system log message.

func (*ExecutorGenerator) EndTime

func (eg *ExecutorGenerator) EndTime(t time.Time) *Event

EndTime updates an executor's end time log.

func (*ExecutorGenerator) Error

func (eg *ExecutorGenerator) Error(msg string, args ...interface{}) *Event

Error creates an error level system log message.

func (*ExecutorGenerator) ExitCode

func (eg *ExecutorGenerator) ExitCode(x int) *Event

ExitCode updates an executor's exit code log.

func (*ExecutorGenerator) Info

func (eg *ExecutorGenerator) Info(msg string, args ...interface{}) *Event

Info creates an info level system log message.

func (*ExecutorGenerator) StartTime

func (eg *ExecutorGenerator) StartTime(t time.Time) *Event

StartTime updates an executor's start time log.

func (*ExecutorGenerator) Stderr

func (eg *ExecutorGenerator) Stderr(s string) *Event

Stderr appends to an executor's stderr log.

func (*ExecutorGenerator) Stdout

func (eg *ExecutorGenerator) Stdout(s string) *Event

Stdout appends to an executor's stdout log.

type ExecutorWriter

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

ExecutorWriter is a type that generates and writes executor events.

func NewExecutorWriter

func NewExecutorWriter(taskID string, attempt uint32, index uint32, w Writer) *ExecutorWriter

NewExecutorWriter returns a ExecutorWriter instance.

func (*ExecutorWriter) Debug

func (ew *ExecutorWriter) Debug(msg string, args ...interface{}) error

Debug writes a debug level system log message.

func (*ExecutorWriter) EndTime

func (ew *ExecutorWriter) EndTime(t time.Time) error

EndTime updates the task's end time log.

func (*ExecutorWriter) Error

func (ew *ExecutorWriter) Error(msg string, args ...interface{}) error

Error writes an error level system log message.

func (*ExecutorWriter) ExitCode

func (ew *ExecutorWriter) ExitCode(x int) error

ExitCode updates an executor's exit code log.

func (*ExecutorWriter) Info

func (ew *ExecutorWriter) Info(msg string, args ...interface{}) error

Info writes an info level system log message.

func (*ExecutorWriter) LogTail

func (ew *ExecutorWriter) LogTail(ctx context.Context, size int64) (stdout, stderr io.Writer)

LogTail returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events.

func (*ExecutorWriter) StartTime

func (ew *ExecutorWriter) StartTime(t time.Time) error

StartTime updates the task's start time log.

func (*ExecutorWriter) Stderr

func (ew *ExecutorWriter) Stderr(s string) error

Stderr appends to an executor's stderr log.

func (*ExecutorWriter) Stdout

func (ew *ExecutorWriter) Stdout(s string) error

Stdout appends to an executor's stdout log.

func (*ExecutorWriter) StreamLogTail

func (ew *ExecutorWriter) StreamLogTail(ctx context.Context, size int64, interval time.Duration, wg *sync.WaitGroup) (stdout, stderr io.Writer)

StreamLogTail returns stdout/err io.Writers which will track the tail of the content (up to "size") and emit events. Events are rate limited by "interval", e.g. a max of one event every 5 seconds.

type KafkaReader

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

KafkaReader reads events to a Kafka topic and writes them to a Writer.

func NewKafkaReader

func NewKafkaReader(ctx context.Context, conf config.Kafka, w Writer) (*KafkaReader, error)

NewKafkaReader creates a new event reader for reading events from a Kafka topic and writing them to the given Writer.

type KafkaWriter

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

KafkaWriter writes events to a Kafka topic.

func NewKafkaWriter

func NewKafkaWriter(ctx context.Context, conf config.Kafka) (*KafkaWriter, error)

NewKafkaWriter creates a new event writer for writing events to a Kafka topic.

func (*KafkaWriter) Close

func (k *KafkaWriter) Close()

func (*KafkaWriter) WriteEvent

func (k *KafkaWriter) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes the event. Events may be sent in batches in the background by the Kafka client library. Currently stdout, stderr, and system log events are dropped.

type Logger

type Logger struct {
	Log *logger.Logger
}

Logger writes events to a funnel logger.

func (*Logger) Close

func (el *Logger) Close()

func (*Logger) WriteEvent

func (el *Logger) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes an event to the logger.

type Metadata

type Metadata struct {
	Value map[string]string `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Metadata) Descriptor deprecated

func (*Metadata) Descriptor() ([]byte, []int)

Deprecated: Use Metadata.ProtoReflect.Descriptor instead.

func (*Metadata) GetValue

func (x *Metadata) GetValue() map[string]string

func (*Metadata) ProtoMessage

func (*Metadata) ProtoMessage()

func (*Metadata) ProtoReflect

func (x *Metadata) ProtoReflect() protoreflect.Message

func (*Metadata) Reset

func (x *Metadata) Reset()

func (*Metadata) String

func (x *Metadata) String() string

type MultiWriter

type MultiWriter []Writer

MultiWriter allows writing an event to a list of Writers. Writing stops on the first error.

func (*MultiWriter) Close

func (mw *MultiWriter) Close()

func (*MultiWriter) WriteEvent

func (mw *MultiWriter) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes an event to all the writers. Writing stops on the first error.

type Noop

type Noop struct{}

Noop provides an event writer that does nothing.

func (Noop) Close

func (n Noop) Close()

func (Noop) WriteEvent

func (n Noop) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent does nothing and returns nil.

type Outputs

type Outputs struct {
	Value []*tes.OutputFileLog `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Outputs) Descriptor deprecated

func (*Outputs) Descriptor() ([]byte, []int)

Deprecated: Use Outputs.ProtoReflect.Descriptor instead.

func (*Outputs) GetValue

func (x *Outputs) GetValue() []*tes.OutputFileLog

func (*Outputs) ProtoMessage

func (*Outputs) ProtoMessage()

func (*Outputs) ProtoReflect

func (x *Outputs) ProtoReflect() protoreflect.Message

func (*Outputs) Reset

func (x *Outputs) Reset()

func (*Outputs) String

func (x *Outputs) String() string

type PubSubWriter

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

PubSubWriter writes events to Google Cloud Pub/Sub.

func NewPubSubWriter

func NewPubSubWriter(ctx context.Context, conf config.PubSub) (*PubSubWriter, error)

NewPubSubWriter creates a new PubSubWriter.

The given context is used to shut down the Pub/Sub client and flush any buffered messages.

Stdout, stderr, and system log events are not sent.

func (*PubSubWriter) Close

func (p *PubSubWriter) Close()

func (*PubSubWriter) WriteEvent

func (p *PubSubWriter) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes an event to the configured Pub/Sub topic. Events are buffered and sent in batches by a background routine. Stdout, stderr, and system log events are not sent.

type RPCWriter

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

RPCWriter is a type which writes Events to RPC.

func NewRPCWriter

func NewRPCWriter(ctx context.Context, conf config.RPCClient) (*RPCWriter, error)

NewRPCWriter returns a new RPCWriter instance.

func (*RPCWriter) Close

func (r *RPCWriter) Close()

Close closes the connection.

func (*RPCWriter) WriteEvent

func (r *RPCWriter) WriteEvent(ctx context.Context, e *Event) error

WriteEvent writes the event to the server via gRPC. The RPC call may timeout, based on the timeout given by the configuration in NewRPCWriter.

type Service

type Service struct {
	UnimplementedEventServiceServer
	Writer
}

Service is a wrapper for providing a Writer as a gRPC service.

func (*Service) WriteEvent

func (s *Service) WriteEvent(ctx context.Context, e *Event) (*WriteEventResponse, error)

WriteEvent accepts an RPC call and writes the event to the underlying server. WriteEventResponse is always empty, and the error value is the error from the undelrying Writer.

type SystemLog

type SystemLog struct {
	Msg    string            `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	Level  string            `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"`
	Fields map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SystemLog) Descriptor deprecated

func (*SystemLog) Descriptor() ([]byte, []int)

Deprecated: Use SystemLog.ProtoReflect.Descriptor instead.

func (*SystemLog) GetFields

func (x *SystemLog) GetFields() map[string]string

func (*SystemLog) GetLevel

func (x *SystemLog) GetLevel() string

func (*SystemLog) GetMsg

func (x *SystemLog) GetMsg() string

func (*SystemLog) ProtoMessage

func (*SystemLog) ProtoMessage()

func (*SystemLog) ProtoReflect

func (x *SystemLog) ProtoReflect() protoreflect.Message

func (*SystemLog) Reset

func (x *SystemLog) Reset()

func (*SystemLog) String

func (x *SystemLog) String() string

type SystemLogFilter

type SystemLogFilter struct {
	Writer Writer
	Level  string
}

SystemLogFilter is an event writer implementation that filters system log events.

func (*SystemLogFilter) Close

func (w *SystemLogFilter) Close()

func (*SystemLogFilter) WriteEvent

func (w *SystemLogFilter) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent writes an event to the writer. Writing stops on the first error.

type SystemLogGenerator

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

SystemLogGenerator is a type that emulates the logger interface and outputs Events.

func (*SystemLogGenerator) Debug

func (sle *SystemLogGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates an Event for a 'debug' level log message

func (*SystemLogGenerator) Error

func (sle *SystemLogGenerator) Error(msg string, args ...interface{}) *Event

Error creates an Event for an 'error' level log message

func (*SystemLogGenerator) Info

func (sle *SystemLogGenerator) Info(msg string, args ...interface{}) *Event

Info creates an Event for an 'info' level log message

func (*SystemLogGenerator) Warn

func (sle *SystemLogGenerator) Warn(msg string, args ...interface{}) *Event

Warn creates an Event for an 'warning' level log message

type SystemLogWriter

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

SystemLogWriter is a type that emulates the logger interface and outputs Events.

func (*SystemLogWriter) Debug

func (sle *SystemLogWriter) Debug(msg string, args ...interface{}) error

Debug writes an for a 'debug' level log message

func (*SystemLogWriter) Error

func (sle *SystemLogWriter) Error(msg string, args ...interface{}) error

Error writes an Event for an 'error' level log message

func (*SystemLogWriter) Info

func (sle *SystemLogWriter) Info(msg string, args ...interface{}) error

Info writes an Event for an 'info' level log message

func (*SystemLogWriter) Warn

func (sle *SystemLogWriter) Warn(msg string, args ...interface{}) error

Warn writes an Event for an 'warning' level log message

type TaskBuilder

type TaskBuilder struct {
	*tes.Task
}

TaskBuilder aggregates events into an in-memory Task object.

func (TaskBuilder) Close

func (tb TaskBuilder) Close()

func (TaskBuilder) WriteEvent

func (tb TaskBuilder) WriteEvent(ctx context.Context, ev *Event) error

WriteEvent updates the Task object.

type TaskGenerator

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

TaskGenerator is a type that generates Events for a given Task execution attempt.

func NewTaskGenerator

func NewTaskGenerator(taskID string, attempt uint32) *TaskGenerator

NewTaskGenerator creates a TaskGenerator instance.

func (*TaskGenerator) Debug

func (eg *TaskGenerator) Debug(msg string, args ...interface{}) *Event

Debug creates a debug level system log message.

func (*TaskGenerator) EndTime

func (eg *TaskGenerator) EndTime(t time.Time) *Event

EndTime updates the task's end time log.

func (*TaskGenerator) Error

func (eg *TaskGenerator) Error(msg string, args ...interface{}) *Event

Error creates an error level system log message.

func (*TaskGenerator) Info

func (eg *TaskGenerator) Info(msg string, args ...interface{}) *Event

Info creates an info level system log message.

func (*TaskGenerator) Metadata

func (eg *TaskGenerator) Metadata(m map[string]string) *Event

Metadata updates the task's metadata log.

func (*TaskGenerator) Outputs

func (eg *TaskGenerator) Outputs(f []*tes.OutputFileLog) *Event

Outputs updates the task's output file log.

func (*TaskGenerator) StartTime

func (eg *TaskGenerator) StartTime(t time.Time) *Event

StartTime updates the task's start time log.

func (*TaskGenerator) State

func (eg *TaskGenerator) State(s tes.State) *Event

State sets the state of the task.

func (*TaskGenerator) Warn

func (eg *TaskGenerator) Warn(msg string, args ...interface{}) *Event

Warn creates a warning level system log message.

type TaskWriter

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

TaskWriter is a type that generates and writes task events.

func NewTaskWriter

func NewTaskWriter(taskID string, attempt uint32, w Writer) *TaskWriter

NewTaskWriter returns a TaskWriter instance.

func (*TaskWriter) Debug

func (ew *TaskWriter) Debug(msg string, args ...interface{}) error

Debug creates a debug level system log message.

func (*TaskWriter) EndTime

func (ew *TaskWriter) EndTime(t time.Time) error

EndTime updates the task's end time log.

func (*TaskWriter) Error

func (ew *TaskWriter) Error(msg string, args ...interface{}) error

Error creates an error level system log message.

func (*TaskWriter) Info

func (ew *TaskWriter) Info(msg string, args ...interface{}) error

Info creates an info level system log message.

func (*TaskWriter) Metadata

func (ew *TaskWriter) Metadata(m map[string]string) error

Metadata updates the task's metadata log.

func (*TaskWriter) NewExecutorWriter

func (ew *TaskWriter) NewExecutorWriter(index uint32) *ExecutorWriter

NewExecutorWriter returns a new ExecutorEventWriter instance that inherits its config from the Task

func (*TaskWriter) Outputs

func (ew *TaskWriter) Outputs(f []*tes.OutputFileLog) error

Outputs updates the task's output file log.

func (*TaskWriter) StartTime

func (ew *TaskWriter) StartTime(t time.Time) error

StartTime updates the task's start time log.

func (*TaskWriter) State

func (ew *TaskWriter) State(s tes.State) error

State sets the state of the task.

func (*TaskWriter) Warn

func (ew *TaskWriter) Warn(msg string, args ...interface{}) error

Warn creates a warning level system log message.

type Type

type Type int32
const (
	Type_UNKNOWN             Type = 0
	Type_TASK_STATE          Type = 1
	Type_TASK_START_TIME     Type = 2
	Type_TASK_END_TIME       Type = 3
	Type_TASK_OUTPUTS        Type = 4
	Type_TASK_METADATA       Type = 5
	Type_EXECUTOR_START_TIME Type = 6
	Type_EXECUTOR_END_TIME   Type = 7
	Type_EXECUTOR_EXIT_CODE  Type = 8
	Type_EXECUTOR_STDOUT     Type = 11
	Type_EXECUTOR_STDERR     Type = 12
	Type_SYSTEM_LOG          Type = 13
	Type_TASK_CREATED        Type = 14
)

func (Type) Descriptor

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated

func (Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Type.Descriptor instead.

func (Type) Number

func (x Type) Number() protoreflect.EnumNumber

func (Type) String

func (x Type) String() string

func (Type) Type

func (Type) Type() protoreflect.EnumType

type UnimplementedEventServiceServer

type UnimplementedEventServiceServer struct {
}

UnimplementedEventServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedEventServiceServer) WriteEvent

type UnsafeEventServiceServer

type UnsafeEventServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeEventServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EventServiceServer will result in compilation errors.

type WriteEventResponse

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

func (*WriteEventResponse) Descriptor deprecated

func (*WriteEventResponse) Descriptor() ([]byte, []int)

Deprecated: Use WriteEventResponse.ProtoReflect.Descriptor instead.

func (*WriteEventResponse) ProtoMessage

func (*WriteEventResponse) ProtoMessage()

func (*WriteEventResponse) ProtoReflect

func (x *WriteEventResponse) ProtoReflect() protoreflect.Message

func (*WriteEventResponse) Reset

func (x *WriteEventResponse) Reset()

func (*WriteEventResponse) String

func (x *WriteEventResponse) String() string

type Writer

type Writer interface {
	WriteEvent(context.Context, *Event) error
	Close()
}

Writer provides write access to a task's events

Jump to

Keyboard shortcuts

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