From edf82c595f520ab4d8c0585c7543fd85a88a27c1 Mon Sep 17 00:00:00 2001 From: pb Date: Tue, 13 Aug 2024 16:15:39 +0200 Subject: [PATCH] modified start --- main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 28a4d4a..954ba85 100644 --- a/main.go +++ b/main.go @@ -60,9 +60,16 @@ func main() { oclib.SetConfig(conf.GetConfig().MongoUrl,conf.GetConfig().Database) oclib.Init("oc-monitor") - wf_id := retrieveWorkflowId(conf.GetConfig().ExecutionID) + wf_id := getWorkflowId(conf.GetConfig().ExecutionID) conf.GetConfig().WorkflowID = wf_id + logger.Debug().Msg("Starting construction of yaml argo for workflow :" + wf_id) + + if _, err := os.Stat("./argo_workflows/"); os.IsNotExist(err) { + os.Mkdir("./argo_workflows/",0755) + logger.Info().Msg("Created argo_workflows/") + } + // // create argo new_wf := workflow_builder.WorflowDB{} @@ -83,13 +90,12 @@ func main() { wf_logger = logger.With().Str("argo_name", workflowName).Str("workflow_id",conf.GetConfig().WorkflowID).Str("workflow_execution_id",conf.GetConfig().ExecutionID).Logger() wf_logger.Debug().Msg("Testing argo name") - executeWorkflow(argo_file_path) - fmt.Println("Logs sent to Loki successfully.") } -func retrieveWorkflowId(exec_id string) string { +// Return the Workflow ID associated to a workflow execution object +func getWorkflowId(exec_id string) string { res := oclib.LoadOne(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION),exec_id)