Documentation ¶
Index ¶
- type TaskBBS
- func (bbs *TaskBBS) ClaimTask(taskGuid string, executorID string) error
- func (bbs *TaskBBS) CompleteTask(taskGuid string, failed bool, failureReason string, result string) error
- func (bbs *TaskBBS) ConvergeTask(timeToClaim time.Duration, convergenceInterval time.Duration)
- func (s *TaskBBS) DesireTask(task models.Task) error
- func (bbs *TaskBBS) GetAllClaimedTasks() ([]models.Task, error)
- func (bbs *TaskBBS) GetAllCompletedTasks() ([]models.Task, error)
- func (bbs *TaskBBS) GetAllPendingTasks() ([]models.Task, error)
- func (bbs *TaskBBS) GetAllResolvingTasks() ([]models.Task, error)
- func (bbs *TaskBBS) GetAllRunningTasks() ([]models.Task, error)
- func (bbs *TaskBBS) GetAllTasks() ([]models.Task, error)
- func (bbs *TaskBBS) ResolveTask(taskGuid string) error
- func (bbs *TaskBBS) ResolvingTask(taskGuid string) error
- func (bbs *TaskBBS) StartTask(taskGuid string, executorID string, containerHandle string) error
- func (bbs *TaskBBS) WatchForCompletedTask() (<-chan models.Task, chan<- bool, <-chan error)
- func (bbs *TaskBBS) WatchForDesiredTask() (<-chan models.Task, chan<- bool, <-chan error)
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 ¶
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 ¶
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 ¶
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 (*TaskBBS) GetAllCompletedTasks ¶
func (*TaskBBS) GetAllPendingTasks ¶
func (*TaskBBS) GetAllResolvingTasks ¶
func (*TaskBBS) GetAllRunningTasks ¶
func (*TaskBBS) ResolveTask ¶
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 ¶
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 ¶
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