Documentation ¶
Overview ¶
Package server contains code for serving the Funnel API, and accessing database backends.
Index ¶
- func NewMarshaler() runtime.Marshaler
- type CustomMarshal
- func (marshal *CustomMarshal) ContentType(i interface{}) string
- func (mclean *CustomMarshal) DetectView(task *tes.Task) (tes.View, error)
- func (mclean *CustomMarshal) Marshal(v interface{}) ([]byte, error)
- func (mclean *CustomMarshal) MarshalList(list *tes.ListTasksResponse) ([]byte, error)
- func (mclean *CustomMarshal) MarshalTask(task *tes.Task) ([]byte, error)
- func (mclean *CustomMarshal) NewDecoder(r io.Reader) runtime.Decoder
- func (mclean *CustomMarshal) NewEncoder(w io.Writer) runtime.Encoder
- func (mclean *CustomMarshal) TranslateTask(task *tes.Task, view tes.View) interface{}
- func (mclean *CustomMarshal) Unmarshal(data []byte, v interface{}) error
- type JSONError
- type Server
- type TaskService
- func (ts *TaskService) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)
- func (ts *TaskService) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)
- func (ts *TaskService) GetServiceInfo(ctx context.Context, info *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)
- func (ts *TaskService) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)
- func (ts *TaskService) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMarshaler ¶
Types ¶
type CustomMarshal ¶
type CustomMarshal struct {
// contains filtered or unexported fields
}
CustomMarshal is a custom marshaler for the GRPC gateway that returns the required fields based on the View value: - View_MINIMAL: returns only the id and state fields - View_BASIC: returns the id, state, creation_time, description, name, inputs, outputs, resources, tags, volumes, executors, and logs fields - View_FULL: returns all fields
This could be improved by updating the generated protobuf code to include the View field in the Task struct Related discussion: https://github.com/ohsu-comp-bio/funnel/pull/716#discussion_r1375155983
func (*CustomMarshal) ContentType ¶
func (marshal *CustomMarshal) ContentType(i interface{}) string
ContentType return content type of marshler
func (*CustomMarshal) DetectView ¶
func (*CustomMarshal) Marshal ¶
func (mclean *CustomMarshal) Marshal(v interface{}) ([]byte, error)
Marshal serializes v into a JSON encoded byte array. If v is of type `proto.Message` the then field "result" is extracted and returned by itself. This is mainly to get around a weird behavior of the GRPC gateway streaming output
func (*CustomMarshal) MarshalList ¶
func (mclean *CustomMarshal) MarshalList(list *tes.ListTasksResponse) ([]byte, error)
func (*CustomMarshal) MarshalTask ¶
func (mclean *CustomMarshal) MarshalTask(task *tes.Task) ([]byte, error)
func (*CustomMarshal) NewDecoder ¶
func (mclean *CustomMarshal) NewDecoder(r io.Reader) runtime.Decoder
NewDecoder shims runtime.Marshaler.NewDecoder
func (*CustomMarshal) NewEncoder ¶
func (mclean *CustomMarshal) NewEncoder(w io.Writer) runtime.Encoder
NewEncoder shims runtime.Marshaler.NewEncoder
func (*CustomMarshal) TranslateTask ¶
func (mclean *CustomMarshal) TranslateTask(task *tes.Task, view tes.View) interface{}
func (*CustomMarshal) Unmarshal ¶
func (mclean *CustomMarshal) Unmarshal(data []byte, v interface{}) error
Unmarshal shims runtime.Marshaler.Unmarshal
type Server ¶
type Server struct { RPCAddress string HTTPPort string BasicAuth []config.BasicCredential Tasks tes.TaskServiceServer Events events.EventServiceServer Nodes scheduler.SchedulerServiceServer DisableHTTPCache bool Log *logger.Logger }
Server represents a Funnel server. The server handles RPC traffic via gRPC, HTTP traffic for the TES API, and also serves the web dashboard.
type TaskService ¶
type TaskService struct { tes.UnimplementedTaskServiceServer Name string Event events.Writer Compute events.Computer Read tes.ReadOnlyServer Log *logger.Logger }
TaskService is a wrapper which handles common TES Task Service operations, such as initializing a task when CreateTask is called. The TaskService 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 (*TaskService) CancelTask ¶
func (ts *TaskService) CancelTask(ctx context.Context, req *tes.CancelTaskRequest) (*tes.CancelTaskResponse, error)
CancelTask cancels a task
func (*TaskService) CreateTask ¶
func (ts *TaskService) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error)
CreateTask provides an HTTP/gRPC endpoint for creating a task. This is part of the TES implementation.
func (*TaskService) GetServiceInfo ¶
func (ts *TaskService) GetServiceInfo(ctx context.Context, info *tes.GetServiceInfoRequest) (*tes.ServiceInfo, error)
GetServiceInfo returns service metadata.
func (*TaskService) GetTask ¶
func (ts *TaskService) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error)
GetTask calls GetTask on the underlying tes.ReadOnlyServer. If the underlying server returns tes.ErrNotFound, TaskService will handle returning the appropriate gRPC error.
func (*TaskService) ListTasks ¶
func (ts *TaskService) ListTasks(ctx context.Context, req *tes.ListTasksRequest) (*tes.ListTasksResponse, error)
ListTasks calls ListTasks on the underlying tes.ReadOnlyServer.