change for the win

This commit is contained in:
mr 2024-09-25 15:46:39 +02:00
parent 3e4ac40109
commit 42375a60cb
3 changed files with 31 additions and 34 deletions

12
main.go
View File

@ -62,11 +62,7 @@ func main() {
monitorLocal = true
loadConfig(true, nil)
}
logger = logs.CreateLogger("oc-monitord")
logger.Debug().Msg("Loki URL : " + conf.GetConfig().LokiURL)
logger.Debug().Msg("Workflow executed : " + conf.GetConfig().ExecutionID)
oclib.Init("oc-monitord")
oclib.SetConfig(
conf.GetConfig().MongoURL,
@ -75,7 +71,11 @@ func main() {
conf.GetConfig().LokiURL,
conf.GetConfig().Logs,
)
oclib.Init("oc-monitord")
logger = logs.CreateLogger("oc-monitord")
logger.Debug().Msg("Loki URL : " + conf.GetConfig().LokiURL)
logger.Debug().Msg("Workflow executed : " + conf.GetConfig().ExecutionID)
wf_id := getWorkflowId(conf.GetConfig().ExecutionID)
conf.GetConfig().WorkflowID = wf_id

Binary file not shown.

View File

@ -5,6 +5,7 @@
package workflow_builder
import (
"fmt"
. "oc-monitord/models"
"os"
"slices"
@ -52,12 +53,10 @@ func (b *ArgoBuilder) CreateDAG() (string, error) {
b.createNginxVolumes()
b.createTemplates()
b.createDAGstep()
b.createVolumes()
if b.Timeout > 0 {
b.Workflow.Spec.Timeout = b.Timeout
}
@ -116,7 +115,7 @@ func (b *ArgoBuilder) createTemplates() {
new_temp.Container.VolumeMounts = append(new_temp.Container.VolumeMounts, VolumeMount{Name: "workdir", MountPath: "/mnt/vol"}) // TODO : replace this with a search of the storage / data source name
new_temp.Container.VolumeMounts = append(new_temp.Container.VolumeMounts, VolumeMount{Name: "nginx-demo", MountPath: "/usr/share/nginx"}) // Used for processing services' demo with nginx
if (b.isService(comp.ID)){
if b.isService(comp.ID) {
serv := b.CreateService(comp)
b.createService(serv, argo_name, comp.ID)
new_temp.Metadata.Labels = make(map[string]string)
@ -180,13 +179,13 @@ func (b *ArgoBuilder) createNginxVolumes() {
b.Workflow.Spec.Volumes = append(b.Workflow.Spec.Volumes, new_volume)
}
func (b *ArgoBuilder) getDependency(current_computing_id string) (dependencies []string) {
for _, link := range b.OriginWorkflow.Graph.Links {
if b.OriginWorkflow.Graph.Items[link.Source.ID].Processing == nil {
continue
}
source := b.OriginWorkflow.Graph.Items[link.Source.ID].Processing
fmt.Println("source", source, current_computing_id, link.Destination.ID)
if current_computing_id == link.Destination.ID && source != nil {
dependency_name := getArgoName(source.GetName(), link.Source.ID)
dependencies = append(dependencies, dependency_name)
@ -319,7 +318,6 @@ func (b *ArgoBuilder) isService(id string) bool{
return is_exposed
}
func (b *ArgoBuilder) addLabel(name string, id string) {
argo_name := getArgoName(name, id)
for _, template := range b.Workflow.Spec.Templates {
@ -329,4 +327,3 @@ func (b *ArgoBuilder) addLabel(name string, id string) {
}
}
}