oc-schedulerd/main.go

61 lines
1.3 KiB
Go
Raw Permalink Normal View History

2023-10-18 17:08:53 +02:00
package main
import (
"fmt"
2023-10-18 17:08:53 +02:00
"os"
2024-07-03 10:21:17 +02:00
conf "oc-scheduler/conf"
2024-07-29 15:45:32 +02:00
"oc-scheduler/models"
2024-07-03 10:21:17 +02:00
2024-07-11 18:25:40 +02:00
"oc-scheduler/daemons"
"oc-scheduler/logger"
2023-10-18 17:08:53 +02:00
)
2024-07-11 18:25:40 +02:00
// var log zerolog.Logger
2023-10-18 17:08:53 +02:00
func main() {
2024-07-11 18:25:40 +02:00
// output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}
// log = zerolog.New(output).With().Timestamp().Logger()
2023-10-18 17:08:53 +02:00
2024-07-03 10:21:17 +02:00
app_conf := conf.GetConfig()
apiurl := app_conf.OcCatalogUrl
2024-07-03 10:22:22 +02:00
if _, err := os.Stat("./argo_workflows/"); os.IsNotExist(err) {
os.Mkdir("./argo_workflows/",0755)
2024-07-11 18:25:40 +02:00
logger.Logger.Info().Msg("Created argo_workflows/")
2024-07-03 10:22:22 +02:00
}
2024-07-29 15:45:32 +02:00
var bookings models.ScheduledBooking
2024-07-11 18:25:40 +02:00
2024-07-29 15:45:32 +02:00
sch_mngr := daemons.ScheduleManager{Api_url: apiurl}
sch_mngr.SetBookings(&bookings)
exe_mngr := daemons.ExecutionManager{}
exe_mngr.SetBookings(&bookings)
go sch_mngr.SchedulePolling()
go exe_mngr.RetrieveNextExecutions()
sch_mngr.ListenForWorkflowSubmissions()
2024-07-11 18:25:40 +02:00
// method in Schedule manager that checks the first Schedule object for its start date and exe
// var g Graph
// list, err := g.GetGraphList(apiurl)
// 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)
// }
2024-07-11 18:25:40 +02:00
// g.LoadFrom(list["test-alpr"])
// g.ExportToArgo("test-alpr")
2024-07-29 15:45:32 +02:00
fmt.Print("stop")
2023-10-18 17:08:53 +02:00
}