task_bbs

package
v0.0.0-...-5c6e8b3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2014 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskBBS

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

func New

func New(store storeadapter.StoreAdapter, timeProvider timeprovider.TimeProvider, logger lager.Logger) *TaskBBS

func (*TaskBBS) ClaimTask

func (bbs *TaskBBS) ClaimTask(taskGuid string, executorID string) error

The executor calls this when it wants to claim a task stagerTaskBBS will retry this repeatedly if it gets a StoreTimeout error (up to N seconds?) If this fails, the executor should assume that someone else is handling the claim and should bail

func (*TaskBBS) CompleteTask

func (bbs *TaskBBS) CompleteTask(taskGuid string, failed bool, failureReason string, result string) error

The executor calls this when it has finished running the task (be it success or failure) stagerTaskBBS will retry this repeatedly if it gets a StoreTimeout error (up to N seconds?) This really really shouldn't fail. If it does, blog about it and walk away. If it failed in a consistent way (i.e. key already exists), there's probably a flaw in our design.

func (*TaskBBS) ConvergeTask

func (bbs *TaskBBS) ConvergeTask(timeToClaim time.Duration, convergenceInterval time.Duration)

ConvergeTask is run by *one* executor every X seconds (doesn't really matter what X is.. pick something performant) Converge will: 1. Kick (by setting) any run-onces that are still pending (and have been for > convergence interval) 2. Kick (by setting) any run-onces that are completed (and have been for > convergence interval) 3. Demote to pending any claimed run-onces that have been claimed for > 30s 4. Demote to completed any resolving run-onces that have been resolving for > 30s 5. Mark as failed any run-onces that have been in the pending state for > timeToClaim 6. Mark as failed any claimed or running run-onces whose executor has stopped maintaining presence

func (*TaskBBS) DesireTask

func (s *TaskBBS) DesireTask(task models.Task) error

The stager calls this when it wants to desire a payload stagerTaskBBS will retry this repeatedly if it gets a StoreTimeout error (up to N seconds?) If this fails, the stager should bail and run its "this-failed-to-stage" routine

func (*TaskBBS) GetAllClaimedTasks

func (bbs *TaskBBS) GetAllClaimedTasks() ([]models.Task, error)

func (*TaskBBS) GetAllCompletedTasks

func (bbs *TaskBBS) GetAllCompletedTasks() ([]models.Task, error)

func (*TaskBBS) GetAllPendingTasks

func (bbs *TaskBBS) GetAllPendingTasks() ([]models.Task, error)

func (*TaskBBS) GetAllResolvingTasks

func (bbs *TaskBBS) GetAllResolvingTasks() ([]models.Task, error)

func (*TaskBBS) GetAllRunningTasks

func (bbs *TaskBBS) GetAllRunningTasks() ([]models.Task, error)

func (*TaskBBS) GetAllTasks

func (bbs *TaskBBS) GetAllTasks() ([]models.Task, error)

func (*TaskBBS) ResolveTask

func (bbs *TaskBBS) ResolveTask(taskGuid string) error

The stager calls this when it wants to signal that it has received a completion and is handling it stagerTaskBBS will retry this repeatedly if it gets a StoreTimeout error (up to N seconds?) If this fails, the stager should assume that someone else is handling the completion and should bail

func (*TaskBBS) ResolvingTask

func (bbs *TaskBBS) ResolvingTask(taskGuid string) error

The stager calls this when it wants to claim a completed task. This ensures that only one stager ever attempts to handle a completed task

func (*TaskBBS) StartTask

func (bbs *TaskBBS) StartTask(taskGuid string, executorID string, containerHandle string) error

The executor calls this when it is about to run the task in the claimed container stagerTaskBBS will retry this repeatedly if it gets a StoreTimeout error (up to N seconds?) If this fails, the executor should assume that someone else is running and should clean up and bail

func (*TaskBBS) WatchForCompletedTask

func (bbs *TaskBBS) WatchForCompletedTask() (<-chan models.Task, chan<- bool, <-chan error)

func (*TaskBBS) WatchForDesiredTask

func (bbs *TaskBBS) WatchForDesiredTask() (<-chan models.Task, chan<- bool, <-chan error)

Jump to

Keyboard shortcuts

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