taskmanager

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	LoadWorkflowRunner(string) (workflow.Runner, error)
	DumpWorkflowRunner(workflow.Runner) error
	LoadWorkflow(string) (workflow.Workflow, error)
}

DataStore provides access to workflows, runners and so on

type JobManager

type JobManager struct {
	// Map job aliases to functions providing that job.
	// Jobs receive a notification providing data from the queue and return
	// maps for json to handle
	JobList map[string]func(JobNotification) (map[string]interface{}, error)
}

JobManager contains configuration for Job Task Managers

func NewJobManager

func NewJobManager() (j JobManager)

NewJobManager returns a `JobManager` to route jobs from the queue

func (*JobManager) AddJob

func (j *JobManager) AddJob(key string, f func(JobNotification) (map[string]interface{}, error))

AddJob updates j.JobList with the key 'key' with the value of a function to call

func (JobManager) Consume

func (j JobManager) Consume(body string) (output map[string]interface{}, err error)

Consume handles json from the message queue. It formats it correctly, route the job, and returns output and metadata

type JobNotification

type JobNotification struct {
	Context  map[string]string
	Name     string
	Register string
	Type     string
	UUID     string
}

JobNotification is a container for Unmarshal'd json from the message queue

type MasterManager

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

MasterManager is a container for Master Taskmanager configuration

func NewMasterManager

func NewMasterManager(redisURI string) (m MasterManager)

NewMasterManager returns an initialised Master Taskmanager

func (MasterManager) Consume

func (m MasterManager) Consume(body string) (output map[string]interface{}, err error)

Consume handles json from the message queue; for a Master node these will be responses. Parse messages, update Workflow contexts, write to database and call next step

type TaskManager

type TaskManager interface {
	Consume(string) (map[string]interface{}, error)
}

TaskManager ... A TaskManager contains functions for dealing with RabbitMQ methods and APIs. Both `MasterManager` and `JobManager` implement the methods in this interface

Jump to

Keyboard shortcuts

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