Categorygithub.com/ppacer/core
modulepackage
0.0.11
Repository: https://github.com/ppacer/core.git
Documentation: pkg.go.dev

# README

ppacer

Go Report Card

Ppacer is a DAG scheduler aiming to provide high reliability, high performance and minimal resource overhead.

This repository contains ppacer core Go packages.

Getting started

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.

Development

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

# Packages

Package api provieds information about Scheduler HTTP endpoints.
Package dag provides DAG definition and related functionalities.
Package db contains all communication between ppacer and the database.
Package ds contains implementation for data structures.
Package e2etests contains end-to-end tests for ppacer.
Package exec defines ppacer Executor and related functionalities.
Package meta provides functionalities for parsing Go files ASTs.
Package notify provides a way to send external notifications.
Package pace provides strategies for controlling the pace of events.
Package scheduler provides functionality for creating and starting new Scheduler.
Package timeutils provides time utility functions for ppacer.
No description provided by the author

# Functions

DefaultStarted setups default Scheduler, Executor (in separate goroutines) and starts Scheduler HTTP server.