jobs

package
v1.50.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteJob

func ExecuteJob(ctx context.Context, fn rc.Func, in rc.Params) (rc.Params, int64, error)

ExecuteJob executes new job synchronously and returns a Param suitable for output.

func SetInitialJobID

func SetInitialJobID(id int64)

SetInitialJobID allows for setting jobID before starting any jobs.

func SetOpt

func SetOpt(opt *rc.Options)

SetOpt sets the options when they are known

func StartAsyncJob

func StartAsyncJob(fn rc.Func, in rc.Params) (rc.Params, error)

StartAsyncJob starts a new job asynchronously and returns a Param suitable for output.

Types

type Job

type Job struct {
	ID        int64     `json:"id"`
	Group     string    `json:"group"`
	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`
	Error     string    `json:"error"`
	Finished  bool      `json:"finished"`
	Success   bool      `json:"success"`
	Duration  float64   `json:"duration"`
	Output    rc.Params `json:"output"`
	Stop      func()    `json:"-"`
	// contains filtered or unexported fields
}

Job describes a asynchronous task started via the rc package

type Jobs

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

Jobs describes a collection of running tasks

func (*Jobs) Expire

func (jobs *Jobs) Expire()

Expire expires any jobs that haven't been collected

func (*Jobs) Get

func (jobs *Jobs) Get(ID int64) *Job

Get a job with a given ID or nil if it doesn't exist

func (*Jobs) IDs

func (jobs *Jobs) IDs() (IDs []int64)

IDs returns the IDs of the running jobs

func (*Jobs) NewAsyncJob

func (jobs *Jobs) NewAsyncJob(fn rc.Func, in rc.Params) *Job

NewAsyncJob start a new asynchronous Job off

func (*Jobs) NewSyncJob

func (jobs *Jobs) NewSyncJob(ctx context.Context, in rc.Params) (*Job, context.Context)

NewSyncJob start a new synchronous Job off

Jump to

Keyboard shortcuts

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