Merge branch 'main' of https://cloud.o-forge.io/core/oc-monitord
This commit is contained in:
commit
103f1b4cb0
BIN
oc-monitord
BIN
oc-monitord
Binary file not shown.
@ -7,20 +7,22 @@ package workflow_builder
|
||||
import (
|
||||
. "oc-monitord/models"
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources/workflow/graph"
|
||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||
"github.com/nwtgck/go-fakelish"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type ArgoBuilder struct {
|
||||
graph graph.Graph
|
||||
Workflow Workflow
|
||||
Timeout int
|
||||
OriginWorkflow w.Workflow
|
||||
Workflow Workflow
|
||||
Timeout int
|
||||
}
|
||||
|
||||
type Workflow struct {
|
||||
@ -157,11 +159,11 @@ func (b *ArgoBuilder) createNginxVolumes() {
|
||||
|
||||
|
||||
func (b *ArgoBuilder) getDependency(current_computing_id string) (dependencies []string) {
|
||||
for _, link := range b.graph.Links {
|
||||
for _, link := range b.OriginWorkflow.Graph.Links {
|
||||
if !b.IsProcessing(link.Source.ID) {
|
||||
continue
|
||||
}
|
||||
source := b.graph.Items[link.Source.ID].Processing
|
||||
source := b.OriginWorkflow.Graph.Items[link.Source.ID].Processing
|
||||
if current_computing_id == link.Destination.ID && source != nil {
|
||||
dependency_name := getArgoName(source.GetName(), link.Source.ID)
|
||||
dependencies = append(dependencies, dependency_name)
|
||||
@ -262,7 +264,7 @@ func removeImageName(user_input string) string {
|
||||
|
||||
// Return the graphItem containing a Processing resource, so that we have access to the ID of the graphItem in order to identify it in the links
|
||||
func (b *ArgoBuilder) getProcessings() (list_computings []graph.GraphItem) {
|
||||
for _, item := range b.graph.Items {
|
||||
for _, item := range b.OriginWorkflow.Graph.Items {
|
||||
if item.Processing != nil {
|
||||
list_computings = append(list_computings, item)
|
||||
}
|
||||
@ -271,12 +273,7 @@ func (b *ArgoBuilder) getProcessings() (list_computings []graph.GraphItem) {
|
||||
}
|
||||
|
||||
func (b *ArgoBuilder) IsProcessing(id string) bool {
|
||||
for _, item := range b.graph.Items {
|
||||
if item.Processing != nil && item.Processing.GetID() == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(b.OriginWorkflow.Processings, id)
|
||||
}
|
||||
|
||||
func getStringValue(comp resource_model.AbstractResource, key string) string {
|
||||
|
@ -46,7 +46,7 @@ func (w *WorflowDB) ExportToArgo(timeout int) (string, error) {
|
||||
return "", fmt.Errorf("can't export a graph that has not been loaded yet")
|
||||
}
|
||||
|
||||
argo_builder := ArgoBuilder{graph: *w.Workflow.Graph, Timeout: timeout}
|
||||
argo_builder := ArgoBuilder{OriginWorkflow: *w.Workflow, Timeout: timeout}
|
||||
filename, err := argo_builder.CreateDAG()
|
||||
if err != nil {
|
||||
logger.Error().Msg("Could not create the argo file for " + w.Workflow.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user