runner

package
v0.0.0-...-57f36d7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2017 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeOutNoMemory = errors.New("Task timed out. No available memory.")
	ErrFullQueue       = errors.New("The runner queue is full")

	WaitMemoryTimeout = 10 * time.Second
)

Functions

func RunAsyncRunner

func RunAsyncRunner(ctx context.Context, tasksrv string, tasks chan task.Request, rnr *Runner)

RunAsyncRunner pulls tasks off a queue and processes them

func RunTask

func RunTask(tasks chan task.Request, ctx context.Context, cfg *task.Config) (drivers.RunResult, error)

RunTask helps sending a task.Request into the common concurrency stream. Refer to StartWorkers() to understand what this is about.

func StartWorkers

func StartWorkers(ctx context.Context, rnr *Runner, tasks <-chan task.Request)

StartWorkers operates the common concurrency stream, ie, it will process all IronFunctions tasks, either sync or async. In the process, it also dispatches the workload to either regular or hot functions.

Types

type DefaultFuncLogger

type DefaultFuncLogger struct {
}

FuncLogger reads STDERR output from a container and outputs it in a parseable structured log format, see: https://github.com/pedronasser/functions/issues/76

func (*DefaultFuncLogger) Writer

func (l *DefaultFuncLogger) Writer(ctx context.Context, appName, path, image, reqID string) io.Writer

type DefaultMetricLogger

type DefaultMetricLogger struct{}

func (*DefaultMetricLogger) Log

func (l *DefaultMetricLogger) Log(ctx context.Context, metric map[string]interface{})

func (*DefaultMetricLogger) LogCount

func (l *DefaultMetricLogger) LogCount(ctx context.Context, name string, value int)

func (*DefaultMetricLogger) LogGauge

func (l *DefaultMetricLogger) LogGauge(ctx context.Context, name string, value int)

func (*DefaultMetricLogger) LogTime

func (l *DefaultMetricLogger) LogTime(ctx context.Context, name string, value time.Duration)

type FuncLogger

type FuncLogger interface {
	Writer(context.Context, string, string, string, string) io.Writer
}

func NewFuncLogger

func NewFuncLogger() FuncLogger

type Metric

type Metric map[string]interface{}

type MetricLogger

type MetricLogger interface {
	Log(context.Context, map[string]interface{})
	LogCount(context.Context, string, int)
	LogGauge(context.Context, string, int)
	LogTime(context.Context, string, time.Duration)
}

func NewMetricLogger

func NewMetricLogger() MetricLogger

type Runner

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

func New

func New(ctx context.Context, drv string, flog FuncLogger, mlog MetricLogger) (*Runner, error)

func (*Runner) Complete

func (s *Runner) Complete()

func (*Runner) Enqueue

func (s *Runner) Enqueue()

func (Runner) EnsureImageExists

func (r Runner) EnsureImageExists(ctx context.Context, cfg *task.Config) error

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, cfg *task.Config) (drivers.RunResult, error)

func (*Runner) Start

func (s *Runner) Start()

func (*Runner) Stats

func (s *Runner) Stats() Stats

type Stats

type Stats struct {
	Queue    uint64
	Running  uint64
	Complete uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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