oc-schedulerd/daemons/execute_monitor_local.go

47 lines
1.0 KiB
Go
Raw Normal View History

2024-07-29 15:46:44 +02:00
package daemons
2024-08-09 18:44:33 +02:00
import (
"oc-scheduler/conf"
2024-08-09 18:44:33 +02:00
"oc-scheduler/logger"
"os/exec"
)
2024-07-29 15:46:44 +02:00
type LocalMonitor struct{
2024-08-09 18:44:33 +02:00
LokiURL string
KubeURL string
WorkflowName string
2024-07-29 15:46:44 +02:00
}
func (lm *LocalMonitor) LaunchLocalMonitor (){
2024-08-09 18:44:33 +02:00
if (lm.LokiURL == "" || lm.KubeURL == "" || lm.WorkflowName == ""){
2024-07-29 15:46:44 +02:00
logger.Logger.Error().Msg("Missing parameter in LocalMonitor")
}
// For dev purposes, in prod KubeURL must be a kube API's URL
if(lm.KubeURL == "localhost"){
2024-08-09 18:44:33 +02:00
lm.execLocalKube()
2024-07-29 15:46:44 +02:00
} else{
2024-08-09 18:44:33 +02:00
lm.execRemoteKube()
2024-07-29 15:46:44 +02:00
}
}
2024-08-09 18:44:33 +02:00
func (lm *LocalMonitor) execLocalKube (){
2024-07-29 15:46:44 +02:00
// kube_url := ""
cmd := exec.Command("../oc-monitor/oc-monitor", "-w",lm.WorkflowName, "-u", lm.LokiURL, "-m", conf.GetConfig().MongoUrl,"-d", conf.GetConfig().DBName)
2024-08-09 18:44:33 +02:00
// cmd_ls := exec.Command("ls", "../oc-monitor")
err := cmd.Start()
2024-08-09 18:44:33 +02:00
// output, err := cmd_ls.CombinedOutput()
if err !=nil {
logger.Logger.Error().Msg("Could not start oc-monitor for " + lm.WorkflowName + " : " + err.Error())
}
2024-07-29 15:46:44 +02:00
}
2024-08-09 18:44:33 +02:00
func (lm *LocalMonitor) execRemoteKube (){
2024-07-29 15:46:44 +02:00
}
func (lm *LocalMonitor) todo (){
}