runners

package
v0.1.74 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckForRuntimes added in v0.1.6

func CheckForRuntimes(ctx context.Context, requirements []*agentv0.Runtime) error

func CheckPythonPath added in v0.1.58

func CheckPythonPath() (string, error)

func DockerEngineRunning added in v0.1.35

func DockerEngineRunning(ctx context.Context) bool

func IsFreePort added in v0.1.24

func IsFreePort(port int) bool

func PrintDownloadPercentage added in v0.1.63

func PrintDownloadPercentage(reader io.ReadCloser, out io.Writer)

func WaitForPortUnbound added in v0.1.23

func WaitForPortUnbound(ctx context.Context, port int) error

WaitForPortUnbound waits for the portMapping to be unbound

Types

type CPU added in v0.0.71

type CPU struct {
	// contains filtered or unexported fields
}

type Docker added in v0.0.87

type Docker struct {
	// contains filtered or unexported fields
}

func NewDocker added in v0.0.87

func NewDocker(ctx context.Context, image *configurations.DockerImage) (*Docker, error)

NewDocker creates a new docker runner

func (*Docker) ForwardLogs added in v0.1.24

func (docker *Docker) ForwardLogs(reader io.Reader)

func (*Docker) GetImage added in v0.0.87

func (docker *Docker) GetImage(ctx context.Context, imag *configurations.DockerImage) error

func (*Docker) ImageExists added in v0.0.87

func (docker *Docker) ImageExists(ctx context.Context, imag *configurations.DockerImage) (bool, error)

func (*Docker) Init added in v0.0.87

func (docker *Docker) Init(ctx context.Context) error

func (*Docker) IsRunningContainer added in v0.1.55

func (docker *Docker) IsRunningContainer(ctx context.Context) (bool, error)

func (*Docker) KillAll added in v0.1.55

func (docker *Docker) KillAll(ctx context.Context) error

KillAll kills all Docker containers started by codefly: container name = /codefly-...

func (*Docker) Run added in v0.0.87

func (docker *Docker) Run(ctx context.Context) error

func (*Docker) Running added in v0.1.35

func (docker *Docker) Running() bool

func (*Docker) SetCommand added in v0.1.24

func (docker *Docker) SetCommand(bin string, args ...string)

SetCommand to run

func (*Docker) Start added in v0.0.87

func (docker *Docker) Start(ctx context.Context) error

func (*Docker) Stop added in v0.0.91

func (docker *Docker) Stop() error

func (*Docker) WaitForStop added in v0.1.62

func (docker *Docker) WaitForStop() error

func (*Docker) WithCommand added in v0.1.6

func (docker *Docker) WithCommand(cmd ...string)

func (*Docker) WithEnvironmentVariables added in v0.1.6

func (docker *Docker) WithEnvironmentVariables(envs ...string)

func (*Docker) WithMount added in v0.1.24

func (docker *Docker) WithMount(sourceDir string, targetDir string) *Docker

func (*Docker) WithName added in v0.1.24

func (docker *Docker) WithName(name string)

func (*Docker) WithOut added in v0.1.24

func (docker *Docker) WithOut(writer io.Writer)

func (*Docker) WithPersistence added in v0.1.55

func (docker *Docker) WithPersistence()

func (*Docker) WithPort added in v0.1.6

func (docker *Docker) WithPort(port DockerPortMapping)

func (*Docker) WithSilence added in v0.1.55

func (docker *Docker) WithSilence()

func (*Docker) WithWorkDir added in v0.1.25

func (docker *Docker) WithWorkDir(dir string)

type DockerContainerInstance added in v0.0.87

type DockerContainerInstance struct {
	ID string
}

type DockerPortMapping added in v0.1.24

type DockerPortMapping struct {
	Host      uint16
	Container uint16
}

type DockerPullResponse added in v0.1.63

type DockerPullResponse struct {
	ID             string         `json:"id"`
	Status         string         `json:"status"`
	ProgressDetail ProgressDetail `json:"progressDetail"`
}

type Event added in v0.0.71

type Event struct {
	// Err is the state of error of the service
	Err error

	// Status is the state of the service
	ProcessState

	// CPU
	*observabilityv0.CPU

	// Memory
	*observabilityv0.Memory
}

Event represents data of a **running** service Generic so most fields will be nil

type Memory added in v0.0.71

type Memory struct {
	// contains filtered or unexported fields
}

type MultiReader added in v0.1.22

type MultiReader struct {
	// contains filtered or unexported fields
}

func NewMultiReader added in v0.1.22

func NewMultiReader(readers ...io.Reader) *MultiReader

func (*MultiReader) Read added in v0.1.22

func (mrc *MultiReader) Read(p []byte) (n int, err error)

type Process added in v0.1.62

type Process struct {
	// contains filtered or unexported fields
}

func NewProcess added in v0.1.62

func NewProcess(ctx context.Context, bin string, args ...string) (*Process, error)

func (*Process) Finish added in v0.1.62

func (runner *Process) Finish()

func (*Process) Finished added in v0.1.62

func (runner *Process) Finished() bool

func (*Process) ForwardLogs added in v0.1.62

func (runner *Process) ForwardLogs(reader io.Reader)

func (*Process) Init added in v0.1.62

func (runner *Process) Init(_ context.Context) error

func (*Process) Run added in v0.1.62

func (runner *Process) Run(ctx context.Context) error

Run execute and wait: great for tasks that we expect to finish

func (*Process) Start added in v0.1.62

func (runner *Process) Start(ctx context.Context) error

Start executing and return

func (*Process) Stop added in v0.1.62

func (runner *Process) Stop() error

func (*Process) Wait added in v0.1.62

func (runner *Process) Wait() error

func (*Process) WithDebug added in v0.1.62

func (runner *Process) WithDebug(debug bool) *Process

func (*Process) WithDir added in v0.1.62

func (runner *Process) WithDir(dir string) *Process

func (*Process) WithEnvironmentVariables added in v0.1.62

func (runner *Process) WithEnvironmentVariables(envs ...string) *Process

func (*Process) WithOut added in v0.1.62

func (runner *Process) WithOut(out io.Writer)

type ProcessState added in v0.0.71

type ProcessState int
const (
	Unknown  ProcessState = iota
	NotFound ProcessState = iota
	Running
	InterruptibleSleep
	UninterruptibleSleep
	Stopped
	Zombie
	Dead
	TracingStop
	Idle
	Parked
	Waking
)

func (ProcessState) String added in v0.0.71

func (ps ProcessState) String() string

type ProgressDetail added in v0.1.63

type ProgressDetail struct {
	Current int `json:"current"`
	Total   int `json:"total"`
}

type Runner

type Runner interface {
	Init(ctx context.Context) error
	Run(ctx context.Context) error
	Start(ctx context.Context) error
	Stop() error
}

type Tracked added in v0.0.71

type Tracked interface {
	GetState(ctx context.Context) (ProcessState, error)
	GetCPU(ctx context.Context) (*CPU, error)
	GetMemory(ctx context.Context) (*Memory, error)
}

type TrackedProcess added in v0.0.71

type TrackedProcess struct {
	PID    int
	Killed bool
}

func (*TrackedProcess) GetCPU added in v0.0.71

func (p *TrackedProcess) GetCPU(ctx context.Context) (*CPU, error)

func (*TrackedProcess) GetMemory added in v0.0.71

func (p *TrackedProcess) GetMemory(ctx context.Context) (*Memory, error)

func (*TrackedProcess) GetState added in v0.0.71

func (p *TrackedProcess) GetState(ctx context.Context) (ProcessState, error)

Jump to

Keyboard shortcuts

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