coordinator

package
v0.0.0-...-c9cfaf6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

Package coordinator implements a benchmark task manager and API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(c *http.Client, url, worker string) *Client

func (*Client) Fail

func (c *Client) Fail(ctx context.Context, id uuid.UUID) error

func (*Client) Halt

func (c *Client) Halt(ctx context.Context, id uuid.UUID) error

func (*Client) Jobs

func (c *Client) Jobs(ctx context.Context) (*JobsResponse, error)

func (*Client) Start

func (c *Client) Start(ctx context.Context, id uuid.UUID) error

func (*Client) UploadResult

func (c *Client) UploadResult(ctx context.Context, id uuid.UUID, r io.Reader) error

UploadResult uploads a benchmark result file for the given job ID. Note the reader will be closed if it is an io.ReadCloser.

type Coordinator

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

func New

func New(d *db.DB, s sched.Scheduler, w fs.Writable) *Coordinator

func (*Coordinator) Jobs

func (c *Coordinator) Jobs(ctx context.Context, req *JobsRequest) (*JobsResponse, error)

Jobs requests next jobs for a worker.

func (*Coordinator) Result

func (c *Coordinator) Result(ctx context.Context, req *ResultRequest) error

Result processes a datafile upload.

func (*Coordinator) SetLogger

func (c *Coordinator) SetLogger(l *zap.Logger)

SetLogger sets the logger used by the Coordinator.

func (*Coordinator) StatusChange

func (c *Coordinator) StatusChange(ctx context.Context, req *StatusChangeRequest) error

StatusChange records a job status change.

type Handlers

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

func NewHandlers

func NewHandlers(c *Coordinator, l *zap.Logger) *Handlers

func (*Handlers) ServeHTTP

func (h *Handlers) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Job

type Job struct {
	UUID      uuid.UUID `json:"uuid"`
	CommitSHA string    `json:"commit_sha"`
	Suite     job.Suite `json:"suite"`
}

type JobsRequest

type JobsRequest struct {
	Worker string
}

func (*JobsRequest) Validate

func (r *JobsRequest) Validate() error

type JobsResponse

type JobsResponse struct {
	Jobs []*Job `json:"jobs"`
}

func NoJobsAvailable

func NoJobsAvailable() *JobsResponse

type ResultRequest

type ResultRequest struct {
	io.Reader // data file

	Worker string
	UUID   uuid.UUID
}

func (*ResultRequest) Validate

func (r *ResultRequest) Validate() error

type StatusChangeRequest

type StatusChangeRequest struct {
	Worker string
	UUID   uuid.UUID
	From   []entity.TaskStatus
	To     entity.TaskStatus
}

func (*StatusChangeRequest) Validate

func (r *StatusChangeRequest) Validate() error

Jump to

Keyboard shortcuts

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