@@ -3,12 +3,13 @@ package prunner
33import (
44 "context"
55 "fmt"
6- "github.com/Flowpack/prunner/helper/slice_utils"
76 "io"
87 "sort"
98 "sync"
109 "time"
1110
11+ "github.com/Flowpack/prunner/helper/slice_utils"
12+
1213 "github.com/Flowpack/prunner/store"
1314
1415 "github.com/apex/log"
@@ -873,13 +874,6 @@ func (r *PipelineRunner) runningJobsCount(pipeline string) int {
873874 return running
874875}
875876
876- // waitlistModifierFn modifies the wait list, if the job cannot be executed right away.
877- type waitlistModifierFn func (previousWaitlist []* PipelineJob , job * PipelineJob ) []* PipelineJob
878-
879- func waitlistAppendToQueue (previousWaitlist []* PipelineJob , job * PipelineJob ) []* PipelineJob {
880- return append (previousWaitlist , job )
881- }
882-
883877func getQueueStrategyImpl (queueStrategy definition.QueueStrategy ) QueueStrategyImpl {
884878 switch queueStrategy {
885879 case definition .QueueStrategyAppend :
@@ -894,18 +888,14 @@ func getQueueStrategyImpl(queueStrategy definition.QueueStrategy) QueueStrategyI
894888}
895889
896890func (r * PipelineRunner ) isSchedulable (pipeline string ) bool {
897- // TODO REPLACE ME!!!
898- return true
899- /*action := r.resolveScheduleAction(pipeline)
900- switch action {
901- case scheduleActionReplace:
902- fallthrough
903- case scheduleActionQueue:
904- fallthrough
905- case scheduleActionStart:
906- return true
907- }
908- return false*/
891+ pipelineDef , ok := r .defs .Pipelines [pipeline ]
892+ if ! ok {
893+ return false
894+ }
895+
896+ queueStrategyImpl := getQueueStrategyImpl (pipelineDef .QueueStrategy )
897+ err := queueStrategyImpl .canAcceptJob (pipelineDef , r .waitListByPipeline [pipeline ])
898+ return err == nil
909899}
910900
911901type ScheduleOpts struct {
0 commit comments