Build up Clean Schedulerd + Lib Kube

This commit is contained in:
mr
2026-02-25 13:19:46 +01:00
parent 142a81197b
commit dbc41f0326
9 changed files with 315 additions and 193 deletions

View File

@@ -1,7 +1,6 @@
package daemons
import (
"oc-schedulerd/conf"
"time"
oclib "cloud.o-forge.io/core/oc-lib"
@@ -79,37 +78,16 @@ func (em *ExecutionManager) executeExecution(execution *workflow_execution.Workf
duration = int(execution.EndDate.Sub(execution.ExecDate).Seconds())
}
if conf.GetConfig().Mode == "local" {
executor = NewLocalMonitor(execution.UUID, execution.CreatorID, duration)
}
if conf.GetConfig().Mode == "container" {
executor = NewContainerMonitor(execution.UUID, execution.CreatorID, duration)
}
executor = NewContainerMonitor(execution.UUID, execution.CreatorID, duration)
if executor == nil {
logger.Fatal().Msg("Could not create executor")
oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION), nil).UpdateOne(map[string]interface{}{
"state": enum.FAILURE.EnumIndex(),
}, execution.GetID())
return
}
args := executor.PrepareMonitorExec()
executor.LaunchMonitor(args, logger)
// if exec_method == "k8s" {
// logger.Error().Msg("TODO : executing oc-monitor in a k8s")
// } else {
// logger.Debug().Msg("Executing oc-monitor localy")
// duration := 0
// if Execution.EndDate != nil {
// duration = int(Execution.EndDate.Sub(Execution.ExecDate).Seconds())
// }
// monitor := LocalMonitor{
// Logger: logger,
// Duration: duration,
// ExecutionID: Execution.ExecutionsID,
// PeerID: Execution.CreatorID,
// LokiUrl: conf.GetConfig().LokiUrl,
// }
// monitor.LaunchLocalMonitor()
// }
executor.LaunchMonitor(args, execution.GetID(), logger)
}