added conf/ and configuration logic
This commit is contained in:
parent
dd6f112954
commit
f9e5c591bd
@ -61,7 +61,7 @@ func (b *ArgoBuilder) CreateDAG() bool {
|
|||||||
// Give a unique name to each argo file with its timestamp DD:MM:YYYY_hhmmss
|
// Give a unique name to each argo file with its timestamp DD:MM:YYYY_hhmmss
|
||||||
current_timestamp := time.Now().Format("02_01_2006_150405")
|
current_timestamp := time.Now().Format("02_01_2006_150405")
|
||||||
file_name := random_name + "_" + current_timestamp + ".yml"
|
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)
|
err = os.WriteFile(workflows_dir + file_name , []byte(yamlified), 0660)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logs.Error("Could not write the yaml file")
|
logs.Error("Could not write the yaml file")
|
||||||
|
@ -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 <font color=blue>struct</font>{[]Parameter}
|
|
||||||
|
|
||||||
}
|
|
||||||
class Template << (S,Aquamarine) >> {
|
|
||||||
+ Name string
|
|
||||||
+ Inputs <font color=blue>struct</font>{[]Parameter}
|
|
||||||
+ Container Container
|
|
||||||
+ Dag Dag
|
|
||||||
|
|
||||||
}
|
|
||||||
class VolumeClaimTemplate << (S,Aquamarine) >> {
|
|
||||||
+ Metadata <font color=blue>struct</font>{string}
|
|
||||||
+ Spec VolumeSpec
|
|
||||||
|
|
||||||
}
|
|
||||||
class VolumeMount << (S,Aquamarine) >> {
|
|
||||||
+ Name string
|
|
||||||
+ MountPath string
|
|
||||||
|
|
||||||
}
|
|
||||||
class VolumeSpec << (S,Aquamarine) >> {
|
|
||||||
+ AccessModes []string
|
|
||||||
+ Resources <font color=blue>struct</font>{<font color=blue>struct</font>{string}}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Workflow << (S,Aquamarine) >> {
|
|
||||||
+ ApiVersion string
|
|
||||||
+ Kind string
|
|
||||||
+ Metadata <font color=blue>struct</font>{string}
|
|
||||||
+ Spec Spec
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@enduml
|
|
@ -15,7 +15,7 @@ type Config struct {
|
|||||||
var instance *Config
|
var instance *Config
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
|
||||||
const defaultConfigFile = "/app/conf/scheduler.json"
|
const defaultConfigFile = "/etc/oc/scheduler.json"
|
||||||
const localConfigFile = "./conf/local_scheduler.json"
|
const localConfigFile = "./conf/local_scheduler.json"
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +48,6 @@ func init(){
|
|||||||
|
|
||||||
GetConfig().OcCatalogUrl = o.GetStringDefault("oc-catalog", "https://localhost:49618")
|
GetConfig().OcCatalogUrl = o.GetStringDefault("oc-catalog", "https://localhost:49618")
|
||||||
GetConfig().Logs = o.GetStringDefault("loglevel", "info")
|
GetConfig().Logs = o.GetStringDefault("loglevel", "info")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig() *Config {
|
func GetConfig() *Config {
|
||||||
|
6
graph.go
6
graph.go
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-catalog/models"
|
"cloud.o-forge.io/core/oc-catalog/models"
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ type Graph struct {
|
|||||||
ws HttpQuery
|
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) {
|
func (g *Graph) GetGraphList(apiurl string) (map[string]string, error) {
|
||||||
g.ws.Init(apiurl)
|
g.ws.Init(apiurl)
|
||||||
body, err := g.ws.Get("v1/workspace/list")
|
body, err := g.ws.Get("v1/workspace/list")
|
||||||
@ -48,8 +47,9 @@ func (g *Graph) LoadFrom(workspace string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
_ = decodedValue
|
||||||
|
|
||||||
os.WriteFile("graph.xml", []byte(decodedValue), 0660)
|
// os.WriteFile("graph.xml", []byte(decodedValue), 0660)
|
||||||
|
|
||||||
g.GetWorkflowComponents(workspace)
|
g.GetWorkflowComponents(workspace)
|
||||||
g.GetLinks(workspace)
|
g.GetLinks(workspace)
|
||||||
|
10
main.go
10
main.go
@ -25,13 +25,23 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Msg("Failed to get the workspaces list, check api url and that api server is up : " + apiurl)
|
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 {
|
for workspace, _ := range list {
|
||||||
println(workspace)
|
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.LoadFrom(list["test-alpr"])
|
||||||
g.ExportToArgo("test-alpr")
|
g.ExportToArgo("test-alpr")
|
||||||
|
|
||||||
|
for(1 == 1){
|
||||||
|
fmt.Print("")
|
||||||
|
}
|
||||||
fmt.Print("stop")
|
fmt.Print("stop")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
oc-scheduler
BIN
oc-scheduler
Binary file not shown.
Loading…
Reference in New Issue
Block a user