Jobs & Workflows https://armen.surge.sh
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.6 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### main ####### Copyright (c) 2021 mls-361 #################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package main
import (
"time"
"forge.chapril.org/armen/armen-jw/factory"
"forge.chapril.org/armen/armen-jw/jw"
"forge.chapril.org/armen/armen-jw/model"
"forge.chapril.org/armen/armen-namespace/runner"
"forge.chapril.org/armen/armen-sdk/logger"
"forge.chapril.org/armen/armen-sdk/sdk"
"forge.chapril.org/armen/armen-workers/pool"
)
var (
_version string
_builtAt string
)
func main() {
logger := logger.Default
logger.Trace("armen", sdk.Fields{"version": _version, "builtAt": _builtAt})
model := model.New(&model.Config{})
nsRunner := runner.New("namespace", model)
_ = nsRunner.AddJobHandler("type", runner.JHF(func(job *runner.Job) *jw.Result {
return nil
}))
pool, err := pool.New(&pool.Config{
Size: 3,
Model: model,
})
if err != nil {
logger.Fatal(err.Error(), nil)
return
}
_ = pool.AddRunner(nsRunner)
pool.Start()
time.Sleep(1 * time.Second)
factory := factory.New(model)
_, _ = factory.NewCoreJob("namespace", "type").
UUID().
Name("name").
Origin("Origin").
PriorityLow().
CreateJob()
time.Sleep(1 * time.Second)
pool.Stop()
}
/*
######################################################################################################## @(°_°)@ #######
*/