task

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTask

func CreateTask(name string, opts ...Option) (*tasks.Signature, error)

func RunRemoteScript

func RunRemoteScript(ctx context.Context, script, user, host, cert string, timeoutSec int) error

Types

type Option

type Option func(signature *tasks.Signature) (*tasks.Signature, error)

func WithHostPort

func WithHostPort(host string, port int) Option

func WithSSHCert

func WithSSHCert(cert []byte) Option

func WithScript

func WithScript(script string) Option

type Service

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

Service orchestrates everything related to running tasks, currently it delegated running tasks to the machinery

func NewService

func NewService(cnf *config.Config) (*Service, error)

NewService creates the task service instance.

func (*Service) RegisterTaskFunction

func (s *Service) RegisterTaskFunction(taskName string, fn interface{}) error

RegisterTaskFunction in order to invoke task handler function it should be registered in machinery the function could have an arbitrary number of arguments however it is mandatory to return an error as the last one.

func (*Service) Send

func (s *Service) Send(ctx context.Context, task *tasks.Signature) (*result.AsyncResult, error)

Send individual task to be executed.

func (*Service) SendChain

func (s *Service) SendChain(ctx context.Context, chain *tasks.Chain) (*result.ChainAsyncResult, error)

SendChain executed a chain of tasks.

Jump to

Keyboard shortcuts

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