update state work properly
This commit is contained in:
9
main.go
9
main.go
@@ -19,6 +19,7 @@ import (
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/logs"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
|
||||
@@ -47,7 +48,7 @@ const localConfigFile = "./conf/local_ocmonitord_conf.json"
|
||||
|
||||
func main() {
|
||||
|
||||
os.Setenv("test_service","true") // Only for service demo, delete before merging on main
|
||||
os.Setenv("test_service", "true") // Only for service demo, delete before merging on main
|
||||
|
||||
monitorLocal = false
|
||||
// Test if monitor is launched outside (with parameters) or in a k8s environment (env variables sets)
|
||||
@@ -69,7 +70,7 @@ func main() {
|
||||
logger.Debug().Msg("Loki URL : " + conf.GetConfig().LokiURL)
|
||||
logger.Debug().Msg("Workflow executed : " + conf.GetConfig().ExecutionID)
|
||||
|
||||
oclib.Init("oc-monitord","","")
|
||||
oclib.Init("oc-monitord", "", "")
|
||||
|
||||
wf_id := getWorkflowId(conf.GetConfig().ExecutionID)
|
||||
conf.GetConfig().WorkflowID = wf_id
|
||||
@@ -242,7 +243,6 @@ func setConf(is_k8s bool, o *onion.Onion, parser *argparse.Parser) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func initOnion(o *onion.Onion) *onion.Onion {
|
||||
logger = logs.CreateLogger("oc-monitord", "")
|
||||
configFile := ""
|
||||
@@ -294,10 +294,11 @@ func checkStatus(current string, previous string) {
|
||||
func updateStatus(status string) {
|
||||
exec_id := conf.GetConfig().ExecutionID
|
||||
|
||||
wf_exec := &workflow_execution.WorkflowExecution{}
|
||||
wf_exec := &workflow_execution.WorkflowExecution{AbstractObject: utils.AbstractObject{UUID: conf.GetConfig().ExecutionID}}
|
||||
wf_exec.ArgoStatusToState(status)
|
||||
|
||||
serialized := wf_exec.Serialize()
|
||||
|
||||
res := oclib.UpdateOne(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION), serialized, exec_id)
|
||||
|
||||
if res.Code != 200 {
|
||||
|
||||
Reference in New Issue
Block a user