diff --git a/argo_builder.go b/argo_builder.go index 6e68d27..f4189e7 100644 --- a/argo_builder.go +++ b/argo_builder.go @@ -61,7 +61,7 @@ func (b *ArgoBuilder) CreateDAG() bool { // Give a unique name to each argo file with its timestamp DD:MM:YYYY_hhmmss current_timestamp := time.Now().Format("02_01_2006_150405") file_name := random_name + "_" + current_timestamp + ".yml" - workflows_dir := "workflows_argo/" + workflows_dir := "argo_workflows/" err = os.WriteFile(workflows_dir + file_name , []byte(yamlified), 0660) if err != nil { logs.Error("Could not write the yaml file") diff --git a/classe_scheduler.puml b/classe_scheduler.puml deleted file mode 100644 index d686034..0000000 --- a/classe_scheduler.puml +++ /dev/null @@ -1,86 +0,0 @@ -@startuml -namespace main { - class ArgoBuilder << (S,Aquamarine) >> { - - graph Graph - - branches [][]string - - + Workflow Workflow - - - createTemplates() - - createDAGstep() - - createVolumes() - - getDependency(current_computing_id string) []string - - + CreateDAG() bool - - } - class Container << (S,Aquamarine) >> { - + Image string - + Command []string - + Args []string - + VolumeMounts []VolumeMount - - } - class Dag << (S,Aquamarine) >> { - + Tasks []Task - - } - - class Link << (S,Aquamarine) >> { - + Src string - + Dst string - - } - class Parameter << (S,Aquamarine) >> { - + Name string - + Value string - - } - class Spec << (S,Aquamarine) >> { - + Entrypoint string - + Arguments []Parameter - + Volumes []VolumeClaimTemplate - + Templates []Template - - } - class Task << (S,Aquamarine) >> { - + Name string - + Template string - + Dependencies []string - + Arguments struct{[]Parameter} - - } - class Template << (S,Aquamarine) >> { - + Name string - + Inputs struct{[]Parameter} - + Container Container - + Dag Dag - - } - class VolumeClaimTemplate << (S,Aquamarine) >> { - + Metadata struct{string} - + Spec VolumeSpec - - } - class VolumeMount << (S,Aquamarine) >> { - + Name string - + MountPath string - - } - class VolumeSpec << (S,Aquamarine) >> { - + AccessModes []string - + Resources struct{struct{string}} - - } - - class Workflow << (S,Aquamarine) >> { - + ApiVersion string - + Kind string - + Metadata struct{string} - + Spec Spec - - } -} - - -@enduml diff --git a/conf/conf.go b/conf/conf.go index 9923b38..10b8816 100644 --- a/conf/conf.go +++ b/conf/conf.go @@ -15,7 +15,7 @@ type Config struct { var instance *Config var once sync.Once -const defaultConfigFile = "/app/conf/scheduler.json" +const defaultConfigFile = "/etc/oc/scheduler.json" const localConfigFile = "./conf/local_scheduler.json" @@ -48,7 +48,6 @@ func init(){ GetConfig().OcCatalogUrl = o.GetStringDefault("oc-catalog", "https://localhost:49618") GetConfig().Logs = o.GetStringDefault("loglevel", "info") - } func GetConfig() *Config { diff --git a/graph.go b/graph.go index be04e11..1847bb4 100644 --- a/graph.go +++ b/graph.go @@ -5,7 +5,6 @@ import ( "fmt" "maps" "net/url" - "os" "cloud.o-forge.io/core/oc-catalog/models" @@ -24,7 +23,7 @@ type Graph struct { ws HttpQuery } -// Create a dictionnaries with each each existing workflow from a workspace, associated to the JSON representation of its content +// Create a dictionnaries with each existing workflow from a workspace, associated to the JSON representation of its content func (g *Graph) GetGraphList(apiurl string) (map[string]string, error) { g.ws.Init(apiurl) body, err := g.ws.Get("v1/workspace/list") @@ -48,8 +47,9 @@ func (g *Graph) LoadFrom(workspace string) error { if err != nil { return err } + _ = decodedValue - os.WriteFile("graph.xml", []byte(decodedValue), 0660) + // os.WriteFile("graph.xml", []byte(decodedValue), 0660) g.GetWorkflowComponents(workspace) g.GetLinks(workspace) diff --git a/main.go b/main.go index ec9d540..33b5646 100644 --- a/main.go +++ b/main.go @@ -25,13 +25,23 @@ func main() { if err != nil { log.Fatal().Msg("Failed to get the workspaces list, check api url and that api server is up : " + apiurl) } + + println("Available workspaces :") for workspace, _ := range list { println(workspace) } + if _, err := os.Stat("./argo_workflows/"); os.IsNotExist(err) { + os.Mkdir("./argo_workflows/",0755) + log.Info().Msg("Created argo_workflows/") + } + g.LoadFrom(list["test-alpr"]) g.ExportToArgo("test-alpr") + for(1 == 1){ + fmt.Print("") + } fmt.Print("stop") } diff --git a/oc-scheduler b/oc-scheduler index 9e423e5..7874e7e 100755 Binary files a/oc-scheduler and b/oc-scheduler differ