Documentation ¶
Index ¶
- Constants
- type Engine
- func (e *Engine) AddDep(fromTaskID string, toTaskID string) error
- func (e *Engine) AddTask(taskName string)
- func (e *Engine) Execute(visitor Visitor, opts EngineExecutionOptions) []error
- func (e *Engine) Prepare(options *EngineBuildingOptions) error
- func (e *Engine) ValidatePersistentDependencies(graph *graph.CompleteGraph, concurrency int) error
- type EngineBuildingOptions
- type EngineExecutionOptions
- type MissingTaskError
- type StopExecutionSentinel
- type Task
- type Visitor
Constants ¶
const ROOT_NODE_NAME = "___ROOT___"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct { // TaskGraph is a graph of package-tasks TaskGraph *dag.AcyclicGraph PackageTaskDeps map[string][]string // contains filtered or unexported fields }
Engine contains both the DAG for the packages and the tasks and implements the methods to execute tasks in them
func NewEngine ¶
func NewEngine( completeGraph *graph.CompleteGraph, isSinglePackage bool, ) *Engine
NewEngine creates a new engine given a topologic graph of workspace package names
func (*Engine) AddDep ¶
AddDep adds tuples from+to task ID combos in tuple format so they can be looked up later.
func (*Engine) Execute ¶
func (e *Engine) Execute(visitor Visitor, opts EngineExecutionOptions) []error
Execute executes the pipeline, constructing an internal task graph and walking it accordingly.
func (*Engine) Prepare ¶
func (e *Engine) Prepare(options *EngineBuildingOptions) error
Prepare constructs the Task Graph for a list of packages and tasks
func (*Engine) ValidatePersistentDependencies ¶
func (e *Engine) ValidatePersistentDependencies(graph *graph.CompleteGraph, concurrency int) error
ValidatePersistentDependencies checks if any task dependsOn persistent tasks and throws an error if that task is actually implemented
type EngineBuildingOptions ¶
type EngineBuildingOptions struct { // Packages in the execution scope, if nil, all packages will be considered in scope Packages []string // TaskNames in the execution scope, if nil, all tasks will be executed TaskNames []string // Restrict execution to only the listed task names TasksOnly bool }
EngineBuildingOptions help construct the TaskGraph
type EngineExecutionOptions ¶
type EngineExecutionOptions struct { // Parallel is whether to run tasks in parallel Parallel bool // Concurrency is the number of concurrent tasks that can be executed Concurrency int }
EngineExecutionOptions controls a single walk of the task graph
type MissingTaskError ¶
type MissingTaskError struct {
// contains filtered or unexported fields
}
MissingTaskError is a specialized Error thrown in the case that we can't find a task. We want to allow this error when getting task definitions, so we have to special case it.
func (*MissingTaskError) Error ¶
func (m *MissingTaskError) Error() string
type StopExecutionSentinel ¶
type StopExecutionSentinel struct {
// contains filtered or unexported fields
}
StopExecutionSentinel is used to return an error from a graph Walk that indicates that all further walking should stop.
func StopExecution ¶
func StopExecution(reason error) *StopExecutionSentinel
StopExecution wraps the given error in a sentinel error indicating that graph traversal should stop. Note that this will stop all tasks, not just downstream tasks.
func (*StopExecutionSentinel) Error ¶
func (se *StopExecutionSentinel) Error() string
Error implements error.Error for StopExecutionSentinel
type Task ¶
type Task struct { Name string // TaskDefinition contains the config for the task from turbo.json TaskDefinition fs.TaskDefinition }
Task is a higher level struct that contains the underlying TaskDefinition but also some adjustments to it, based on business logic.