modified start

This commit is contained in:
pb 2024-08-13 16:15:39 +02:00
parent 1e56094d24
commit edf82c595f

14
main.go
View File

@ -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)