updated the value of ExecutionID in LocalMonitor constructor

This commit is contained in:
pb 2025-05-12 12:35:49 +02:00
parent 6fce8f3aac
commit bcc024caef
3 changed files with 12 additions and 10 deletions

View File

@ -20,10 +20,10 @@ type ContainerMonitor struct {
KubePort string KubePort string
} }
func NewContainerMonitor(executionsId string, peerId string, duration int) (Executor){ func NewContainerMonitor(UUID string, peerId string, duration int) (Executor){
return &ContainerMonitor{ return &ContainerMonitor{
Monitor: LocalMonitor{ Monitor: LocalMonitor{
ExecutionID: executionsId, ExecutionID: UUID,
PeerID: peerId, PeerID: peerId,
Duration: duration, Duration: duration,
LokiUrl: conf.GetConfig().LokiUrl, LokiUrl: conf.GetConfig().LokiUrl,

View File

@ -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{ return &LocalMonitor{
ExecutionID: executionsId, ExecutionID: UUID,
PeerID: peerId, PeerID: peerId,
Duration: duration, Duration: duration,
LokiUrl: conf.GetConfig().LokiUrl, LokiUrl: conf.GetConfig().LokiUrl,

View File

@ -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 // start execution
// create the yaml that describes the pod : filename, path/url to Loki // create the yaml that describes the pod : filename, path/url to Loki
var executor Executor var executor Executor
// exec_method := os.Getenv("MONITOR_METHOD") // exec_method := os.Getenv("MONITOR_METHOD")
logger := oclib.GetLogger() logger := oclib.GetLogger()
duration := 0 duration := 0
if Execution.EndDate != nil { if execution.EndDate != nil {
duration = int(Execution.EndDate.Sub(Execution.ExecDate).Seconds()) duration = int(execution.EndDate.Sub(execution.ExecDate).Seconds())
} }
if conf.GetConfig().Mode == "local" { if conf.GetConfig().Mode == "local" {
executor = NewLocalMonitor(Execution.ExecutionsID, Execution.CreatorID, duration) executor = NewLocalMonitor(execution.UUID, execution.CreatorID, duration)
} }
if conf.GetConfig().Mode == "container" { if conf.GetConfig().Mode == "container" {
executor = NewContainerMonitor(Execution.ExecutionsID, Execution.CreatorID, duration) executor = NewContainerMonitor(execution.UUID, execution.CreatorID, duration)
} }
if executor == nil { if executor == nil {
logger.Fatal().Msg("Could not create logger") logger.Fatal().Msg("Could not create executor")
} }
args := executor.PrepareMonitorExec() args := executor.PrepareMonitorExec()
executor.LaunchMonitor(args,logger) executor.LaunchMonitor(args,logger)