functions: hot containers (#332)

* functions: modify datastore to accomodate hot containers support

* functions: protocol between functions and hot containers

* functions: add hot containers clockwork

* fn: add hot containers support
This commit is contained in:
C Cirello
2016-11-28 18:45:35 +01:00
committed by Pedro Nasser
parent d0429c3dfd
commit ac0044f7d9
31 changed files with 809 additions and 170 deletions

View File

@@ -5,7 +5,6 @@ import (
"context"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"runtime"
@@ -15,6 +14,7 @@ import (
"time"
"github.com/Sirupsen/logrus"
"github.com/iron-io/functions/api/runner/task"
"github.com/iron-io/runner/common"
"github.com/iron-io/runner/drivers"
driverscommon "github.com/iron-io/runner/drivers"
@@ -22,19 +22,6 @@ import (
"github.com/iron-io/runner/drivers/mock"
)
type Config struct {
ID string
Image string
Timeout time.Duration
AppName string
Path string
Memory uint64
Env map[string]string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
type Runner struct {
driver drivers.Driver
taskQueue chan *containerTask
@@ -155,7 +142,7 @@ func (r *Runner) checkMemAndUse(req uint64) bool {
return true
}
func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error) {
func (r *Runner) Run(ctx context.Context, cfg *task.Config) (drivers.RunResult, error) {
var err error
if cfg.Memory == 0 {
@@ -224,7 +211,7 @@ func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error
return result, nil
}
func (r Runner) EnsureImageExists(ctx context.Context, cfg *Config) error {
func (r Runner) EnsureImageExists(ctx context.Context, cfg *task.Config) error {
ctask := &containerTask{
cfg: cfg,
}