Implement getRunner grpc endpoint
This includes refactoring the jobscheduler into the runnermanager. This service manages runner connections and allocating them to pipelines. These requests are done via the pipeline grpc api
This commit is contained in:
+3
-4
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/op/go-logging"
|
||||
|
||||
"git.ohea.xyz/cursorius/server/config"
|
||||
"git.ohea.xyz/cursorius/server/jobscheduler"
|
||||
"git.ohea.xyz/cursorius/server/pipeline_executor"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
@@ -25,7 +24,7 @@ type tag struct {
|
||||
commitHash string
|
||||
}
|
||||
|
||||
func pollJob(repoName string, jobConfig config.Job, runCh chan jobscheduler.Run, pipelineConf config.PipelineConf) {
|
||||
func pollJob(repoName string, jobConfig config.Job, pipelineConf config.PipelineConf) {
|
||||
prevCommits := make(map[string]string)
|
||||
for {
|
||||
time.Sleep(time.Duration(jobConfig.PollInterval) * time.Second)
|
||||
@@ -104,12 +103,12 @@ func pollJob(repoName string, jobConfig config.Job, runCh chan jobscheduler.Run,
|
||||
}
|
||||
}
|
||||
|
||||
func StartPolling(conf config.Config, runCh chan jobscheduler.Run) {
|
||||
func StartPolling(conf config.Config) {
|
||||
for jobName, job := range conf.Jobs {
|
||||
if job.PollInterval == 0 {
|
||||
continue
|
||||
} else {
|
||||
go pollJob(jobName, job, runCh, conf.PipelineConf)
|
||||
go pollJob(jobName, job, conf.PipelineConf)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user