32 lines
544 B
Go
32 lines
544 B
Go
package workflow
|
|
|
|
import (
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
// Sequencer handles sequencing of jobs.
|
|
//
|
|
// It handles the Lifecycle of a Workflow.
|
|
//
|
|
// When Jobs have no dependencies (defined via After), they are run in parallel.
|
|
//
|
|
// Sequencer's instance job is to keep track of the order of Jobs and Steps. NOT RUNNING THEM.
|
|
//
|
|
// Sequencer is thread-safe.
|
|
type Sequencer struct {
|
|
queued Jobs
|
|
finished Jobs
|
|
|
|
reports []SequenceReport
|
|
|
|
mu sync.Mutex
|
|
}
|
|
|
|
type SequenceReport struct {
|
|
started time.Time
|
|
end time.Time
|
|
job Job
|
|
err error
|
|
}
|