jobs

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package jobs contains jobs run by a job manager.

Index

Constants

View Source
const (
	LoadDirectorySourceJob = "Load Directory Source"
	LoadGitSourceJob       = "Load Git Source"
	LoadCommitsJob         = "Load Commits"
	CloneJob               = "Clone"
	PullJob                = "Pull"
	RunJob                 = "Run"
)

Job names.

Variables

View Source
var (
	ErrDuplicate = errors.New("a job already exists")
	ErrCloned    = errors.New("project is already cloned")
	ErrNotCloned = errors.New("project isn't cloned")
)

Errors.

Functions

func Clone

func Clone(ctx context.Context, projectID string, priority models.JobPriority) (string, error)

Clone clones a remote repository locally.

func LoadAllCommits

func LoadAllCommits(ctx context.Context) []string

LoadAllCommits creates jobs to load the commits of every project. It doesn't return errors but will output a log message when errors happen.

func LoadAllSources added in v0.2.0

func LoadAllSources(ctx context.Context) []string

LoadAllSources creates jobs to load the workspaces of every source. It doesn't return errors but will output a log message when errors happen.

func LoadCommits

func LoadCommits(ctx context.Context, projectID string, priority models.JobPriority) (string, error)

LoadCommits loads the commits of a project from a remote repo and updates the project.

func LoadDirectorySource added in v0.2.0

func LoadDirectorySource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)

LoadDirectorySource loads the workspaces of the source and updates it.

func LoadGitSource added in v0.2.0

func LoadGitSource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)

LoadGitSource loads the workspaces of the source and updates it.

func LoadSource added in v0.2.0

func LoadSource(ctx context.Context, sourceID string, priority models.JobPriority) (string, error)

LoadSource loads the workspaces of the source and updates it.

func Pull

func Pull(ctx context.Context, projectID string, priority models.JobPriority) (string, error)

Pull clones a remote repository locally and updates the project.

func Run

func Run(ctx context.Context, taskID string, env []string, priority models.JobPriority) (string, error)

Run runs a task.

func StartPeriodic

func StartPeriodic(
	ctx context.Context,
	waitTime time.Duration,
	chain ...func(context.Context) []string,
) error

StartPeriodic is used to run jobs periodically. The waitTime argument defines how long to wait after jobs are finished to create new ones. The addJobs argument should be a function that creates jobs and returns their IDs. The first round of jobs will be created immediately upon calling this function. This function blocks until the context is canceled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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