oc-schedulerd/daemons/execute_monitor_local.go

47 lines
1.0 KiB
Go

package daemons
import (
"oc-scheduler/conf"
"oc-scheduler/logger"
"os/exec"
)
type LocalMonitor struct{
LokiURL string
KubeURL string
WorkflowName string
}
func (lm *LocalMonitor) LaunchLocalMonitor (){
if (lm.LokiURL == "" || lm.KubeURL == "" || lm.WorkflowName == ""){
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"){
lm.execLocalKube()
} else{
lm.execRemoteKube()
}
}
func (lm *LocalMonitor) execLocalKube (){
// kube_url := ""
cmd := exec.Command("../oc-monitor/oc-monitor", "-w",lm.WorkflowName, "-u", lm.LokiURL, "-m", conf.GetConfig().MongoUrl,"-d", conf.GetConfig().DBName)
// cmd_ls := exec.Command("ls", "../oc-monitor")
err := cmd.Start()
// output, err := cmd_ls.CombinedOutput()
if err !=nil {
logger.Logger.Error().Msg("Could not start oc-monitor for " + lm.WorkflowName + " : " + err.Error())
}
}
func (lm *LocalMonitor) execRemoteKube (){
}
func (lm *LocalMonitor) todo (){
}