Documentation
¶
Overview ¶
Package taskservice implements TES task operations over readers, events, and compute backends.
Index ¶
- Constants
- type Service
- func (ts *Service) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)
- func (ts *Service) Close()
- func (ts *Service) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)
- func (ts *Service) DoPluginAction(ctx context.Context, task *tes.Task, taskType proto.Type) (*proto.JobResponse, error)
- func (ts *Service) GetServiceInfo(ctx context.Context, info *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)
- func (ts *Service) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)
- func (ts *Service) HandleDoPluginAction(ctx context.Context, task *tes.Task, taskType proto.Type) (*proto.JobResponse, error)
- func (ts *Service) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
Constants ¶
const InternalCallKey contextKey = "internalCall"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
tesrpc.UnimplementedTaskServiceServer
Name string
Event events.Writer
Compute compute.Computer
Read taskpolicy.ReadOnlyServer
Log *logger.Logger
Config *config.Config
Plugin proto.Authorize
PluginManager *pluginmanager.Manager
// contains filtered or unexported fields
}
Service is a wrapper which handles common TES Task Service operations, such as initializing a task when CreateTask is called. The Service is backed by two parts: a read API which provides the GetTask and ListTasks endpoints, and a write API which implements the events.Writer interface. Task creation and cancelation is managed by writing events to underlying event writer.
This makes it easier to define task service backends for new databases, and ensures that common operations are handled consistently, such as setting IDs, handling 404s, GetServiceInfo, etc.
func (*Service) CancelTask ¶
func (ts *Service) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)
CancelTask cancels a task
func (*Service) Close ¶
func (ts *Service) Close()
Close waits for in-flight submissions, then closes owned plugin processes once.
func (*Service) CreateTask ¶
CreateTask provides an HTTP/gRPC endpoint for creating a task. This is part of the TES implementation.
func (*Service) DoPluginAction ¶
func (ts *Service) DoPluginAction(ctx context.Context, task *tes.Task, taskType proto.Type) (*proto.JobResponse, error)
LoadPlugins loads plugins for a task.
func (*Service) GetServiceInfo ¶
func (ts *Service) GetServiceInfo(ctx context.Context, info *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)
GetServiceInfo returns service metadata.
func (*Service) GetTask ¶
GetTask calls GetTask on the underlying tes.ReadOnlyServer. If the underlying server returns tes.ErrNotFound, Service will handle returning the appropriate gRPC error.
func (*Service) HandleDoPluginAction ¶
func (*Service) ListTasks ¶
func (ts *Service) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
ListTasks calls ListTasks on the underlying tes.ReadOnlyServer.