diff --git a/daemons/execute_monitor_container.go b/daemons/execute_monitor_container.go index c643f33..02a569f 100644 --- a/daemons/execute_monitor_container.go +++ b/daemons/execute_monitor_container.go @@ -20,10 +20,10 @@ type ContainerMonitor struct { KubePort string } -func NewContainerMonitor(executionsId string, peerId string, duration int) (Executor){ +func NewContainerMonitor(UUID string, peerId string, duration int) (Executor){ return &ContainerMonitor{ Monitor: LocalMonitor{ - ExecutionID: executionsId, + ExecutionID: UUID, PeerID: peerId, Duration: duration, LokiUrl: conf.GetConfig().LokiUrl, diff --git a/daemons/execute_monitor_local.go b/daemons/execute_monitor_local.go index 33c57bf..b228b78 100644 --- a/daemons/execute_monitor_local.go +++ b/daemons/execute_monitor_local.go @@ -18,9 +18,9 @@ type LocalMonitor struct { } -func NewLocalMonitor(executionsId string, peerId string, duration int) (Executor){ +func NewLocalMonitor(UUID string, peerId string, duration int) (Executor){ return &LocalMonitor{ - ExecutionID: executionsId, + ExecutionID: UUID, PeerID: peerId, Duration: duration, LokiUrl: conf.GetConfig().LokiUrl, diff --git a/daemons/execution_manager.go b/daemons/execution_manager.go index fcb48d4..8119bb8 100644 --- a/daemons/execution_manager.go +++ b/daemons/execution_manager.go @@ -35,28 +35,30 @@ func (em *ExecutionManager) RetrieveNextExecutions() { } } -func (em *ExecutionManager) executeExecution(Execution *workflow_execution.WorkflowExecution) { +func (em *ExecutionManager) executeExecution(execution *workflow_execution.WorkflowExecution) { // start execution // create the yaml that describes the pod : filename, path/url to Loki var executor Executor // exec_method := os.Getenv("MONITOR_METHOD") logger := oclib.GetLogger() + duration := 0 - if Execution.EndDate != nil { - duration = int(Execution.EndDate.Sub(Execution.ExecDate).Seconds()) + if execution.EndDate != nil { + duration = int(execution.EndDate.Sub(execution.ExecDate).Seconds()) } if conf.GetConfig().Mode == "local" { - executor = NewLocalMonitor(Execution.ExecutionsID, Execution.CreatorID, duration) + executor = NewLocalMonitor(execution.UUID, execution.CreatorID, duration) } if conf.GetConfig().Mode == "container" { - executor = NewContainerMonitor(Execution.ExecutionsID, Execution.CreatorID, duration) + executor = NewContainerMonitor(execution.UUID, execution.CreatorID, duration) } if executor == nil { - logger.Fatal().Msg("Could not create logger") + logger.Fatal().Msg("Could not create executor") } + args := executor.PrepareMonitorExec() executor.LaunchMonitor(args,logger)