logger adjust

This commit is contained in:
mr
2026-04-10 15:12:39 +02:00
parent a8fa18520c
commit 115d175d45
5 changed files with 39 additions and 32 deletions

View File

@@ -7,10 +7,8 @@ import (
"oc-schedulerd/conf"
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/dbs"
"cloud.o-forge.io/core/oc-lib/models/common/enum"
workflow_execution "cloud.o-forge.io/core/oc-lib/models/workflow_execution"
"go.mongodb.org/mongo-driver/bson/primitive"
)
var Executions = ScheduledExecution{Execs: map[string]workflow_execution.WorkflowExecution{}}
@@ -36,12 +34,10 @@ func (em *ExecutionManager) RetrieveNextExecutions() {
if orderedExec[i] == nil {
continue
}
fmt.Println("Next exec", i)
lead := time.Duration(conf.GetConfig().PrepLeadSeconds) * time.Second
for execId, exec := range orderedExec[i] {
if i == 0 && em.isAStartingExecutionBeforeEnd(&exec) { // BEST EFFORT exception
continue
}
fmt.Println("ExecDate Before", exec.ExecDate.Before(time.Now().UTC().Add(lead)))
// Fire PrepLeadSeconds before the scheduled start so oc-monitord
// has time to pre-pull images and set up infra before ExecDate.
if exec.ExecDate.Before(time.Now().UTC().Add(lead)) {
@@ -64,20 +60,6 @@ func (em *ExecutionManager) RetrieveNextExecutions() {
}
}
func (em *ExecutionManager) isAStartingExecutionBeforeEnd(execution *workflow_execution.WorkflowExecution) bool {
access := workflow_execution.NewAccessor(nil)
l, _, err := access.Search(&dbs.Filters{
And: map[string][]dbs.Filter{
"execution_date": {{Operator: dbs.LTE.String(), Value: primitive.NewDateTimeFromTime(*execution.EndDate)}},
"state": {{Operator: dbs.EQUAL.String(), Value: enum.SCHEDULED}},
}, // TODO later should refine on each endpoint
}, "", false)
if err != nil && len(l) == 0 {
return false
}
return true
}
func (em *ExecutionManager) executeExecution(execution *workflow_execution.WorkflowExecution) {
// start execution
// create the yaml that describes the pod : filename, path/url to Loki