Divided the execution between local and container and created an interface responsible for preparing and launching the execution
This commit is contained in:
@@ -2,7 +2,7 @@ package daemons
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"oc-schedulerd/conf"
|
||||
"time"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
@@ -38,22 +38,44 @@ func (em *ExecutionManager) RetrieveNextExecutions() {
|
||||
func (em *ExecutionManager) executeExecution(Execution *workflow_execution.WorkflowExecution) {
|
||||
// start execution
|
||||
// create the yaml that describes the pod : filename, path/url to Loki
|
||||
exec_method := os.Getenv("MONITOR_METHOD")
|
||||
var executor Executor
|
||||
// exec_method := os.Getenv("MONITOR_METHOD")
|
||||
logger := oclib.GetLogger()
|
||||
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,
|
||||
}
|
||||
monitor.LaunchLocalMonitor()
|
||||
duration := 0
|
||||
if Execution.EndDate != nil {
|
||||
duration = int(Execution.EndDate.Sub(Execution.ExecDate).Seconds())
|
||||
}
|
||||
|
||||
if conf.GetConfig().Mode == "local" {
|
||||
executor = NewLocalMonitor(Execution.ExecutionsID, Execution.CreatorID, duration)
|
||||
}
|
||||
|
||||
if conf.GetConfig().Mode == "container" {
|
||||
executor = NewContainerMonitor(Execution.ExecutionsID, Execution.CreatorID, duration)
|
||||
}
|
||||
|
||||
if executor == nil {
|
||||
logger.Fatal().Msg("Could not create logger")
|
||||
}
|
||||
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()
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user