Browse Source

En cours de développement

master
mls-361 8 months ago
parent
commit
2b2582d36f
  1. 11
      Taskfile.yml
  2. 46
      cmd/main.go
  3. 11
      go.mod
  4. 33
      go.sum

11
Taskfile.yml

@ -10,6 +10,9 @@ vars:
LDFLAGS: -s -w -X 'main._version={{.VERSION}}' -X 'main._builtAt={{.BUILTAT}}'
tasks:
update:
cmds:
- go mod tidy
lint:
cmds:
- golangci-lint run
@ -24,14 +27,8 @@ tasks:
default:
cmds:
- task: update
- task: lint
- task: test
- task: build
update:
cmds:
- go get -u forge.chapril.org/armen/armen-sdk
- go get -u forge.chapril.org/armen/armen-jw
- go get -u forge.chapril.org/armen/armen-namespace
- go get -u forge.chapril.org/armen/armen-workers
- go mod tidy

46
cmd/main.go

@ -9,12 +9,13 @@ package main
import (
"time"
"forge.chapril.org/armen/armen-jw/factory"
"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"
"forge.chapril.org/armen/factory"
"forge.chapril.org/armen/memory"
"forge.chapril.org/armen/model"
"forge.chapril.org/armen/runner"
"forge.chapril.org/armen/workers"
"forge.chapril.org/mls-361/logger"
"forge.chapril.org/mls-361/uuid"
)
var (
@ -23,41 +24,46 @@ var (
)
func main() {
logger := logger.Default
logger.Trace("armen", sdk.Fields{"version": _version, "builtAt": _builtAt})
logger, _ := logger.New(uuid.New(), "armen", "trace", logger.NewStderrOutput())
logger.Trace("armen", "version", _version, "builtAt", _builtAt)
m := model.New(&model.Config{})
factory := factory.New(m)
m, _ := model.New(&model.Config{
Logger: logger,
Storage: memory.New(),
})
f := factory.New(m)
nsRunner := runner.New("namespace", m)
r := runner.New("namespace", m)
_ = nsRunner.AddJobHandler("type", runner.JHF(func(job *runner.Job) *model.JobR {
_ = r.AddJobHandler("type", runner.JHF(func(job *runner.Job) {
//panic("just a test")
return model.JobPending().SetDuration(1 * time.Second)
job.Pending().SetDuration(2 * time.Second).SetError("une simple erreur")
}))
pool, err := pool.New(&pool.Config{
Size: 3,
Model: m,
pool, err := workers.NewPool(&workers.Config{
Logger: logger,
PoolSize: 3,
Model: m,
})
if err != nil {
logger.Fatal(err.Error(), nil)
logger.Fatal(err.Error())
return
}
_ = pool.AddRunner(nsRunner)
_ = pool.AddRunner(r)
pool.Start()
time.Sleep(1 * time.Second)
_, _ = factory.NewJob("namespace", "type").
_, _ = f.NewJob("namespace", "type").
SetName("name").
SetOrigin("origin").
SetPriorityLow().
SetRetries(1).
CreateJob()
time.Sleep(1 * time.Second)
time.Sleep(5 * time.Second)
pool.Stop()

11
go.mod

@ -3,8 +3,11 @@ module forge.chapril.org/armen/armen
go 1.15
require (
forge.chapril.org/armen/armen-jw v0.0.0-20210408171220-1e0dfdc24098
forge.chapril.org/armen/armen-namespace v0.0.0-20210408171324-438f8084013f
forge.chapril.org/armen/armen-sdk v0.0.0-20210407161823-5d9b3ede386d
forge.chapril.org/armen/armen-workers v0.0.0-20210408171843-cd3de4bf6907
forge.chapril.org/armen/factory v0.0.0-20210412162325-3fbf9dcda286
forge.chapril.org/armen/memory v0.0.0-20210412070352-66ed9edba502
forge.chapril.org/armen/model v0.0.0-20210412154311-d5c295c8948d
forge.chapril.org/armen/runner v0.0.0-20210412162406-3993ae556968
forge.chapril.org/armen/workers v0.0.0-20210412162520-403f2a709cb7
forge.chapril.org/mls-361/logger v0.0.0-20210412060637-c1e01ad8bf2c
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff
)

33
go.sum

@ -1,8 +1,25 @@
forge.chapril.org/armen/armen-jw v0.0.0-20210408171220-1e0dfdc24098 h1:b9STiUSGLPUbUHNCBrElVJK+eGM0ZKlGjToTGCfd2Pw=
forge.chapril.org/armen/armen-jw v0.0.0-20210408171220-1e0dfdc24098/go.mod h1:Ua6ar7aM9haldFljzv0hioR6wZLmmADLJmpmwtIRdQM=
forge.chapril.org/armen/armen-namespace v0.0.0-20210408171324-438f8084013f h1:EJdwF0H9NX4fc6e2kURKhUKb8U4bvSZ0dQlBgpeSRDo=
forge.chapril.org/armen/armen-namespace v0.0.0-20210408171324-438f8084013f/go.mod h1:+uGATGUmDCg65B+YdVAmp2mWxhplg2wumkpiVrpz4s0=
forge.chapril.org/armen/armen-sdk v0.0.0-20210407161823-5d9b3ede386d h1:MGmU50wLLCokIRAf4b7Pu8qTlbfDTzhNUIlOgSpyh0w=
forge.chapril.org/armen/armen-sdk v0.0.0-20210407161823-5d9b3ede386d/go.mod h1:we9oWhLZ2hPtsyRDbc6cNih/R+gOpsmK4xJopD2VBOM=
forge.chapril.org/armen/armen-workers v0.0.0-20210408171843-cd3de4bf6907 h1:9v//RGOWnDuXWWn2I/KTEYm+4Z/SyFreySKUtMCFVnM=
forge.chapril.org/armen/armen-workers v0.0.0-20210408171843-cd3de4bf6907/go.mod h1:WQoYVJIhfB7UxIRzmvgobInLje28CEky6pkqEQO0G1E=
forge.chapril.org/armen/factory v0.0.0-20210412162325-3fbf9dcda286 h1:mKMEQ5I0cEQyeXx5rBfvP3yfrzBO9UZ9RsbNAV4u3u8=
forge.chapril.org/armen/factory v0.0.0-20210412162325-3fbf9dcda286/go.mod h1:wW9UZaNl1UzC//HrndVNNy0OUoZq1eSkCU1uVLw5xLM=
forge.chapril.org/armen/jw v0.0.0-20210412070306-7ad253cf9fdc/go.mod h1:i2WfLLkjW4+W+hYB1LpIgZtq6RqSxacnb6Sw63REJHY=
forge.chapril.org/armen/jw v0.0.0-20210412154147-2607fdaab4da h1:C8j0L8C2Q5vcU51kllbEKWljnmWSpt3MnDqVb43jX/U=
forge.chapril.org/armen/jw v0.0.0-20210412154147-2607fdaab4da/go.mod h1:i2WfLLkjW4+W+hYB1LpIgZtq6RqSxacnb6Sw63REJHY=
forge.chapril.org/armen/memory v0.0.0-20210412070352-66ed9edba502 h1:LMZFcv/7WKE58oxf6fLRSBNpbR0jqfsrIYL8pkK9lSw=
forge.chapril.org/armen/memory v0.0.0-20210412070352-66ed9edba502/go.mod h1:/lpnWqjeupmKVbNGA8FpnDLNJuHal9Sdr4JaJEEHxug=
forge.chapril.org/armen/model v0.0.0-20210412154311-d5c295c8948d h1:/p3z9J6LY7bHMcgW+MOX4bMIfEVUZQ2X06YJv2KRNyo=
forge.chapril.org/armen/model v0.0.0-20210412154311-d5c295c8948d/go.mod h1:He+7rIfNjFsY4qzBPbrgmEDzrF5F/eBC7gJO/3NjAG0=
forge.chapril.org/armen/runner v0.0.0-20210412162406-3993ae556968 h1:QKOBxoRn68pVNJGzn8zNIHzuhN/7Vd/yLOihlwyWRt4=
forge.chapril.org/armen/runner v0.0.0-20210412162406-3993ae556968/go.mod h1:tcM/dpUVER2Dhg9MGyHPsnmtmrn0QBqXMripQBpNHVI=
forge.chapril.org/armen/workers v0.0.0-20210412162520-403f2a709cb7 h1:jRr23CCaKd/tPZ+LmObrbNXChj0f8WYc92XEFwoomoY=
forge.chapril.org/armen/workers v0.0.0-20210412162520-403f2a709cb7/go.mod h1:cHBLEwz3r5Q5iIe9zPpYogX9Ln1P2sHuvSE8gj1Urcs=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79 h1:Lh+y98uVFC7btl5FdxKNtokzHD2j14R4ZIgJECao6r4=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79/go.mod h1:JnOkXF+AEkQ4mv65rzW9eVLsauGzOYIUBQB0zUb5NGE=
forge.chapril.org/mls-361/failure v0.0.0-20210411202803-f4c2b4645ba6 h1:hCjlrpSSzJffmiTlFPWiazeuXz7L9ffqA16MK4YFZyw=
forge.chapril.org/mls-361/failure v0.0.0-20210411202803-f4c2b4645ba6/go.mod h1:DyK2Dj+C/nhpKvGiVsWEzK8mfkk140tJPdgIvUNWv9I=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210411202715-0e7c3e922d37 h1:6e1Y7hTJ0B8BYStiZSCdW4+v686rOpstQh2B5SWOhZU=
forge.chapril.org/mls-361/kvfmt v0.0.0-20210411202715-0e7c3e922d37/go.mod h1:bv44R0CAd8lQV4ub1hjLE3kWYwpfsW4Ro9zRnD4YOMU=
forge.chapril.org/mls-361/logger v0.0.0-20210412060637-c1e01ad8bf2c h1:HTrZT+qkWlypm8RD55FQd+dOGAQ6R+UIQv3tHAnhYBI=
forge.chapril.org/mls-361/logger v0.0.0-20210412060637-c1e01ad8bf2c/go.mod h1:ev/wJr88q2BWa/UJsWv6jNqybRhO2VAe4R+1m1ylAl0=
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff h1:N7L3nN/9Wlck9qtIxH6gbQ9sbWtsZ048+eDEdpvD09g=
forge.chapril.org/mls-361/uuid v0.0.0-20210411123640-49d47af267ff/go.mod h1:OAYM+f6ErfC4jbruuG2crA5W7YSpr7+wEs2MrxIzR3Q=
github.com/jinzhu/copier v0.2.8 h1:N8MbL5niMwE3P4dOwurJixz5rMkKfujmMRFmAanSzWE=
github.com/jinzhu/copier v0.2.8/go.mod h1:24xnZezI2Yqac9J61UC6/dG/k76ttpq0DdJI3QmUvro=

Loading…
Cancel
Save