Gestionnaire de jobs et workflows
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.

48 lines
1.3 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### dune ####### Copyright (c) 2021 losyme ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package demo
import (
"time"
"forge.chapril.org/dune/sdk/runner"
)
func (d *Demo) succeeded(_ *runner.Job) {}
func (d *Demo) failed(job *runner.Job) {
job.Failed().SetError("it's only a test") //////////////////////////////////////////////////////////////////////////
}
func (d *Demo) panic(_ *runner.Job) {
panic("it's only a test") //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
func (d *Demo) pending(job *runner.Job) {
v, ok := job.Private["count"]
if ok {
count, ok := v.(int)
if ok {
if count == 3 {
return
}
job.SetPrivate("count", count+1)
} else {
job.Failed().SetError("unexpected error") //////////////////////////////////////////////////////////////////
return
}
} else {
job.SetPrivate("count", 0)
}
job.Pending().SetDuration(2 * time.Second)
}
/*
######################################################################################################## @(°_°)@ #######
*/