argostatus to state
This commit is contained in:
parent
6df71bde1d
commit
0ec80473cc
@ -2,6 +2,7 @@ package workflow_execution
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
@ -45,6 +46,21 @@ type WorkflowExecution struct {
|
|||||||
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"`
|
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution {
|
||||||
|
status = strings.ToLower(status)
|
||||||
|
switch status {
|
||||||
|
case "succeeded": // Succeeded
|
||||||
|
wfa.State = int64(SUCCESS.EnumIndex())
|
||||||
|
case "pending": // Pending
|
||||||
|
wfa.State = int64(SCHEDULED.EnumIndex())
|
||||||
|
case "running": // Running
|
||||||
|
wfa.State = int64(STARTED.EnumIndex())
|
||||||
|
default: // Failed
|
||||||
|
wfa.State = int64(FAILURE.EnumIndex())
|
||||||
|
}
|
||||||
|
return wfa
|
||||||
|
}
|
||||||
|
|
||||||
func (ao *WorkflowExecution) GetID() string {
|
func (ao *WorkflowExecution) GetID() string {
|
||||||
return ao.UUID
|
return ao.UUID
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user