working oc-schedulerd

This commit is contained in:
mr
2025-01-17 17:21:17 +01:00
parent 8eeba712e7
commit 0de2f9842b
19 changed files with 257 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ import (
workflow_execution "cloud.o-forge.io/core/oc-lib/models/workflow_execution"
)
var Bookings = ScheduledBooking{Bookings: []*workflow_execution.WorkflowExecution{}}
var Bookings = ScheduledBooking{Bookings: []*workflow_execution.WorkflowExecutions{}}
type ExecutionManager struct{}
@@ -35,7 +35,7 @@ func (em *ExecutionManager) RetrieveNextExecutions() {
}
}
func (em *ExecutionManager) executeBooking(booking *workflow_execution.WorkflowExecution) {
func (em *ExecutionManager) executeBooking(booking *workflow_execution.WorkflowExecutions) {
// start execution
// create the yaml that describes the pod : filename, path/url to Loki
exec_method := os.Getenv("MONITOR_METHOD")
@@ -45,14 +45,14 @@ func (em *ExecutionManager) executeBooking(booking *workflow_execution.WorkflowE
} else {
logger.Debug().Msg("Executing oc-monitor localy")
duration := 0
if booking.EndDate != nil && booking.ExecDate != nil {
duration = int(booking.EndDate.Sub(*booking.ExecDate).Seconds())
if booking.EndDate != nil {
duration = int(booking.EndDate.Sub(booking.ExecDate).Seconds())
}
monitor := LocalMonitor{
Logger: logger,
Duration: duration,
LokiURL: conf.GetConfig().LokiUrl,
KubeURL: "localhost",
Logger: logger,
Duration: duration,
LokiURL: conf.GetConfig().LokiUrl,
KubeURL: "localhost",
ExecutionID: booking.UUID,
}
monitor.LaunchLocalMonitor()