Implement basic queue, where is it impossible to run two identical job

in parallel
This commit is contained in:
nemunaire 2021-05-09 19:18:48 +02:00
commit af96f82831
4 changed files with 81 additions and 4 deletions

24
queue.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
"github.com/nemunaire/minifaas/engine"
"github.com/nemunaire/minifaas/engine/docker"
)
func FilterRunningContainers(jobtype string) (ret []string, err error) {
ctrs, errr := docker.PsName()
if errr != nil {
return nil, errr
}
return engine.FilterRunningContainers(jobtype, ctrs), nil
}
func CountRunningContainers(jobtype string) (n int, err error) {
ctrs, errr := docker.PsName()
if errr != nil {
return 0, errr
}
return engine.CountRunningContainers(jobtype, ctrs), nil
}