executor

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultMaximumCommandRuntime int
}

Config defines configuration for this provider

type Dependencies

type Dependencies struct {
	Logger           zerolog.Logger
	CommandRuns      providers.CommandRunStorer
	CommandStorer    providers.CommandStorer
	RepositoryStorer providers.RepositoryStorer
	Clock            providers.Clock
}

Dependencies defines dependencies for this provider

type InMemoryExecutor added in v0.0.10

type InMemoryExecutor struct {
	Config
	Dependencies
	// contains filtered or unexported fields
}

InMemoryExecutor defines an Executor which runs commands alongside Krok. It saves runs in a map and constantly updates it. Cancelling will go over all processes belonging to that run and kill them.

func NewInMemoryExecutor added in v0.0.10

func NewInMemoryExecutor(cfg Config, deps Dependencies) *InMemoryExecutor

NewInMemoryExecutor creates a new InMemoryExecutor which will hold all runs in its memory. In case of a crash, human intervention will be required. TODO: Later, save runs in db with the process id to cancel so Krok can pick up runs again.

func (*InMemoryExecutor) CancelRun added in v0.0.10

func (ime *InMemoryExecutor) CancelRun(ctx context.Context, id int) error

CancelRun will cancel a run and mark all commands as cancelled then remove the entry from the run map. If the kill was unsuccessful, the user can try running it again.

func (*InMemoryExecutor) CreateRun added in v0.0.10

func (ime *InMemoryExecutor) CreateRun(ctx context.Context, event *models.Event, commands []*models.Command) error

CreateRun creates a run for an event.

Jump to

Keyboard shortcuts

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