change for the win
This commit is contained in:
parent
3e4ac40109
commit
42375a60cb
12
main.go
12
main.go
@ -62,11 +62,7 @@ func main() {
|
|||||||
monitorLocal = true
|
monitorLocal = true
|
||||||
loadConfig(true, nil)
|
loadConfig(true, nil)
|
||||||
}
|
}
|
||||||
|
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)
|
|
||||||
|
|
||||||
oclib.SetConfig(
|
oclib.SetConfig(
|
||||||
conf.GetConfig().MongoURL,
|
conf.GetConfig().MongoURL,
|
||||||
@ -75,7 +71,11 @@ func main() {
|
|||||||
conf.GetConfig().LokiURL,
|
conf.GetConfig().LokiURL,
|
||||||
conf.GetConfig().Logs,
|
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)
|
wf_id := getWorkflowId(conf.GetConfig().ExecutionID)
|
||||||
conf.GetConfig().WorkflowID = wf_id
|
conf.GetConfig().WorkflowID = wf_id
|
||||||
|
BIN
oc-monitord
BIN
oc-monitord
Binary file not shown.
@ -5,6 +5,7 @@
|
|||||||
package workflow_builder
|
package workflow_builder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
. "oc-monitord/models"
|
. "oc-monitord/models"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
"slices"
|
||||||
@ -52,12 +53,10 @@ func (b *ArgoBuilder) CreateDAG() (string, error) {
|
|||||||
|
|
||||||
b.createNginxVolumes()
|
b.createNginxVolumes()
|
||||||
|
|
||||||
|
|
||||||
b.createTemplates()
|
b.createTemplates()
|
||||||
b.createDAGstep()
|
b.createDAGstep()
|
||||||
b.createVolumes()
|
b.createVolumes()
|
||||||
|
|
||||||
|
|
||||||
if b.Timeout > 0 {
|
if b.Timeout > 0 {
|
||||||
b.Workflow.Spec.Timeout = b.Timeout
|
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: "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
|
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)
|
serv := b.CreateService(comp)
|
||||||
b.createService(serv, argo_name, comp.ID)
|
b.createService(serv, argo_name, comp.ID)
|
||||||
new_temp.Metadata.Labels = make(map[string]string)
|
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)
|
b.Workflow.Spec.Volumes = append(b.Workflow.Spec.Volumes, new_volume)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (b *ArgoBuilder) getDependency(current_computing_id string) (dependencies []string) {
|
func (b *ArgoBuilder) getDependency(current_computing_id string) (dependencies []string) {
|
||||||
for _, link := range b.OriginWorkflow.Graph.Links {
|
for _, link := range b.OriginWorkflow.Graph.Links {
|
||||||
if b.OriginWorkflow.Graph.Items[link.Source.ID].Processing == nil {
|
if b.OriginWorkflow.Graph.Items[link.Source.ID].Processing == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
source := b.OriginWorkflow.Graph.Items[link.Source.ID].Processing
|
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 {
|
if current_computing_id == link.Destination.ID && source != nil {
|
||||||
dependency_name := getArgoName(source.GetName(), link.Source.ID)
|
dependency_name := getArgoName(source.GetName(), link.Source.ID)
|
||||||
dependencies = append(dependencies, dependency_name)
|
dependencies = append(dependencies, dependency_name)
|
||||||
@ -319,7 +318,6 @@ func (b *ArgoBuilder) isService(id string) bool{
|
|||||||
return is_exposed
|
return is_exposed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (b *ArgoBuilder) addLabel(name string, id string) {
|
func (b *ArgoBuilder) addLabel(name string, id string) {
|
||||||
argo_name := getArgoName(name, id)
|
argo_name := getArgoName(name, id)
|
||||||
for _, template := range b.Workflow.Spec.Templates {
|
for _, template := range b.Workflow.Spec.Templates {
|
||||||
@ -329,4 +327,3 @@ func (b *ArgoBuilder) addLabel(name string, id string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user