core

package module
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStarted

func DefaultStarted(ctx context.Context, dags dag.Registry, port int)

DefaultStarted setups default Scheduler, Executor (in separate goroutines) and starts Scheduler HTTP server. This function is meant to reduce boilerplate for simple examples and tests. When there is an error on starting Scheduler server this function panics.

Types

This section is empty.

Directories

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL