task

package
v0.0.0-...-a2df99d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 8 Imported by: 0

README

TaskEvent: a way to send order to the system (ex: how to tell the system to stop a task)


a runner (executable) is an http server that load and serve a wasm file (the runnable)

I replace Docker by Runner

a wasm runner executes/hosts a function

find the wasm edge sample using SCRATCH docker image (useful for the Devoxx University)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidStateTransition

func ValidStateTransition(src State, dst State) bool

Types

type Config

type Config struct {
	Executor             ExecutorType
	ExecutorPath         string // "./galago-wasm-runner/galago-runner"
	WasmFileName         string // "hello.wasm"
	WasmFilePath         string // "./functions/hello.wasm"
	WasmFunctionHttpPort int
	WasmRegistryUrl      string // "https://localhost:9999/hello/hello.wasm"
	FunctionName         string
	FunctionRevision     string
	DefaultRevision      bool
	Env                  []string // WASM_EXECUTOR_HTTP=9090
	Args                 []string // The first argument is the runer
}

func (*Config) Initialize

func (config *Config) Initialize(settings settings.Settings) ExecutorType

type ExecutorType

type ExecutorType int
const (
	Unknown ExecutorType = iota
	Sat
	Galago
)

??? or use interface

type State

type State int
const (
	Pending State = iota
	Scheduled
	Running
	Completed
	Failed
)

type Task

type Task struct {
	Id            uuid.UUID
	Name          string
	State         State
	PreviousState State
	Config        Config
	WasmRunner    WasmRunner
	HttpPort      int
	StartTime     time.Time
	FinishTime    time.Time
	CPU           float64
	Memory        float64
}

func (*Task) ChangeState

func (tsk *Task) ChangeState(newState State)

func (*Task) StartWasmRunner

func (tsk *Task) StartWasmRunner() *WasmRunnerResult

func (*Task) StopWasmRunner

func (tsk *Task) StopWasmRunner() *WasmRunnerResult

type TaskEvent

type TaskEvent struct {
	Id                   uuid.UUID
	Executor             ExecutorType // 1: sat 2: galago (other kind of runner)
	WasmFileName         string
	WasmFunctionHttpPort int
	WasmRegistryUrl      string
	FunctionName         string
	FunctionRevision     string
	DefaultRevision      bool
	Timestamp            time.Time // record the time the event was requested
}

type WasmRunner

type WasmRunner struct {
	RunnerConfig *Config
	RunnerId     uuid.UUID //!!! useful or not?
	Process      *os.Process
}

func (*WasmRunner) Remove

func (wasmRunner *WasmRunner) Remove() *WasmRunnerResult

!!! test if sat or galao (I think it's somewhere else)

func (*WasmRunner) Start

func (wasmRunner *WasmRunner) Start() *WasmRunnerResult

Start() is Run()

func (*WasmRunner) Stop

func (wasmRunner *WasmRunner) Stop() *WasmRunnerResult

type WasmRunnerResult

type WasmRunnerResult struct {
	Error    error
	Action   string
	RunnerId uuid.UUID
	Pid      int
	Result   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL