Ppacer is a DAG scheduler aiming to provide high reliability, high performance and minimal resource overhead.
This repository contains ppacer core Go packages.
If you would like to run ppacer "hello world" example and you do have Go
compiler in version >= 1.22
, you can simply go get
ppacer packages (in
existing Go module)
go get github.com/ppacer/core@latest
go get github.com/ppacer/tasks@latest
go get github.com/ppacer/ui@latest
And then run the following program:
package main
import (
"context"
"time"
"github.com/ppacer/core"
"github.com/ppacer/core/dag"
"github.com/ppacer/core/dag/schedule"
"github.com/ppacer/tasks"
"github.com/ppacer/ui"
)
const (
schedulerPort = 9321
uiPort = 9322
)
func main() {
ctx := context.Background()
dags := dag.Registry{}
dags.Add(printDAG("hello_world_dag"))
go func() {
ui.DefaultStarted(schedulerPort, uiPort)
}()
core.DefaultStarted(ctx, dags, schedulerPort)
}
func printDAG(dagId string) dag.Dag {
// t21
// /
// start
// \
// t22 --> finish
start := dag.NewNode(tasks.NewPrintTask("start", "hello"))
t21 := dag.NewNode(tasks.NewPrintTask("t21", "foo"))
t22 := dag.NewNode(tasks.NewPrintTask("t22", "bar"))
finish := dag.NewNode(tasks.NewPrintTask("finish", "I'm done!"))
start.Next(t21)
start.Next(t22)
t22.Next(finish)
startTs := time.Date(2024, time.March, 11, 12, 0, 0, 0, time.Local)
schedule := schedule.NewFixed(startTs, 10*time.Second)
printDag := dag.New(dag.Id(dagId)).
AddSchedule(&schedule).
AddRoot(start).
Done()
return printDag
}
Detailed instructions and a bit more of explanations are presented here: ppacer/intro.
Developers who use Linux or MacOS can simply run ./build.sh
, to build
packages, run tests and benchmarks.
Default log severity level is set to WARN
. In case you need more details, you
can use PPACER_LOG_LEVEL
env variable, like in the following examples:
PPACER_LOG_LEVEL=INFO go test -v ./...
In case when you need to just debug a single test, you run command similar to the following one:
PPACER_LOG_LEVEL=DEBUG go test -v ./db -run=TestReadDagRunTaskSingle