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
}
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,

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{
ExecutionID: executionsId,
ExecutionID: UUID,
PeerID: peerId,
Duration: duration,
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
// 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)