update
This commit is contained in:
2
Makefile
2
Makefile
@@ -13,7 +13,7 @@ clean:
|
|||||||
rm -rf oc-schedulerd
|
rm -rf oc-schedulerd
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
DOCKER_BUILDKIT=1 docker build -t oc-schedulerd --build-arg MONITORD_IMAGE=oc-monitord -f Dockerfile . --build-arg=HOST=$(HOST)
|
DOCKER_BUILDKIT=1 docker build -t oc-schedulerd --build-arg MONITORD_IMAGE=oc-monitord -f Dockerfile . --build-arg=HOST=$(HOST) --build-arg=KUBERNETES_HOST=$(KUBERNETES_HOST) --build-arg=KUBERNETES_SERVICE_PORT=$(KUBERNETES_SERVICE_PORT) --build-arg=KUBE_CA=$(KUBE_CA) --build-arg=KUBE_CERT=$(KUBE_CERT) --build-arg=KUBE_DATA=$(KUBE_DATA)
|
||||||
docker tag oc-schedulerd:latest oc/oc-schedulerd:0.0.1
|
docker tag oc-schedulerd:latest oc/oc-schedulerd:0.0.1
|
||||||
|
|
||||||
publish-kind:
|
publish-kind:
|
||||||
|
|||||||
@@ -58,10 +58,12 @@ type ScheduleManager struct {
|
|||||||
// on workflows' scheduling. Messages must contain
|
// on workflows' scheduling. Messages must contain
|
||||||
// workflow execution ID, to allow retrieval of execution infos
|
// workflow execution ID, to allow retrieval of execution infos
|
||||||
func (s *ScheduleManager) ListenNATS() {
|
func (s *ScheduleManager) ListenNATS() {
|
||||||
|
for {
|
||||||
nc, err := nats.Connect(oclib.GetConfig().NATSUrl)
|
nc, err := nats.Connect(oclib.GetConfig().NATSUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Logger.Error().Msg("Could not connect to NATS")
|
s.Logger.Error().Msg("Could not connect to NATS")
|
||||||
return
|
time.Sleep(10 * time.Second)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
defer nc.Close()
|
defer nc.Close()
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
@@ -69,7 +71,8 @@ func (s *ScheduleManager) ListenNATS() {
|
|||||||
go s.listenForChange(nc, tools.REMOVE.GenerateKey(oclib.WORKFLOW.String()), true, wg)
|
go s.listenForChange(nc, tools.REMOVE.GenerateKey(oclib.WORKFLOW.String()), true, wg)
|
||||||
go s.listenForChange(nc, tools.CREATE.GenerateKey(oclib.WORKFLOW.String()), false, wg)
|
go s.listenForChange(nc, tools.CREATE.GenerateKey(oclib.WORKFLOW.String()), false, wg)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Goroutine listening to a NATS server for updates
|
// Goroutine listening to a NATS server for updates
|
||||||
@@ -121,7 +124,7 @@ func (s *ScheduleManager) getExecution(from time.Time, to time.Time) (exec_list
|
|||||||
}
|
}
|
||||||
res := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION), "", "", []string{}, nil).Search(&f, "", false)
|
res := oclib.NewRequest(oclib.LibDataEnum(oclib.WORKFLOW_EXECUTION), "", "", []string{}, nil).Search(&f, "", false)
|
||||||
if res.Code != 200 {
|
if res.Code != 200 {
|
||||||
s.Logger.Error().Msg("Error loading")
|
s.Logger.Error().Msg("Error loading " + res.Err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, exec := range res.Data {
|
for _, exec := range res.Data {
|
||||||
|
|||||||
Reference in New Issue
Block a user