job

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 18 Imported by: 16

Documentation

Overview

Package job holds code for managing task execution in robot. The primary concepts are the operations, the device on which jobs run, and the worker which is responsible for running jobs on a device. Devices are persistent, and might not be active, workers only exist for live devices.

Index

Constants

View Source
const (
	UnknownOperation = Operation_UnknownOperation
	Host             = Operation_Host
	Trace            = Operation_Trace
	Report           = Operation_Report
	Replay           = Operation_Replay
)
View Source
const (
	UnknownStatus = Status_UnknownStatus
	Running       = Status_Running
	Succeeded     = Status_Succeeded
	Failed        = Status_Failed
)

Variables

This section is empty.

Functions

func BindRegistry added in v1.1.0

func BindRegistry(ctx context.Context) context.Context

BindRegistry creates a new device registry to monitor new Android devices and returns the context which is bound to the created registry.

func LockDevice added in v1.1.0

func LockDevice(ctx context.Context, d bind.Device) error

LockDevice reserves the given device for the requester, prevents the device to be used by other clients.

func OnDeviceAdded added in v1.1.0

func OnDeviceAdded(ctx context.Context,
	onAdded func(ctx context.Context, host *device.Instance, target bind.Device))

OnDeviceAdded registers onAdded to be called whenever a new Android device is added.

func Serve

func Serve(ctx xctx.Context, grpcServer *grpc.Server, manager Manager) error

Serve wraps a manager in a grpc server.

func UnlockDevice added in v1.1.0

func UnlockDevice(ctx context.Context, d bind.Device) error

UnlockDevices release the given device so other clients can run tasks on it.

Types

type DeviceHandler

type DeviceHandler func(context.Context, *Device) error

DeviceHandler is a function used to consume a stream of Devices.

type Manager

type Manager interface {
	// SearchDevices delivers matching workers to the supplied handler.
	SearchDevices(ctx context.Context, query *search.Query, handler DeviceHandler) error
	// SearchWorkers delivers matching workers to the supplied handler.
	SearchWorkers(ctx context.Context, query *search.Query, handler WorkerHandler) error
	// GetWorker finds or adds a worker.
	GetWorker(ctx context.Context, host *device.Instance, target *device.Instance, op Operation) (*Worker, error)
}

Manager is the abstract interface to the job manager.

func NewLocal

func NewLocal(ctx context.Context, library record.Library) (Manager, error)

NewLocal builds a new job manager that persists it's data in the supplied library.

func NewRemote

func NewRemote(ctx context.Context, conn *grpc.ClientConn) Manager

NewRemote returns a job manager that talks to a remote grpc job manager.

type WorkerHandler

type WorkerHandler func(context.Context, *Worker) error

WorkerHandler is a function used to consume a stream of Workers.

Directories

Path Synopsis
Package worker is a set of helpers for implementing common features of robot workers (see package job for more information about what a worker is).
Package worker is a set of helpers for implementing common features of robot workers (see package job for more information about what a worker is).

Jump to

Keyboard shortcuts

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