runners

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: BSD-2-Clause, Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoreRunner added in v0.2.6

type CoreRunner interface {
	client.CoreAgent
	DataRoot() string
	OnCreateAgent(*client.CreateAgent)
}

Runners are agents that act on CreateAgent messages We require the runner to tell us where it's putting agent data runners can lie so it's up to the interface user to handle any security. Core's philosophy is more permissive, with secure backstops at other security layers.

We can't add properties to interfaces, we we require the runner to tell us how it'd like the handle new messages using a return function.

type LocalRunner

type LocalRunner struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

func NewLocalRunner

func NewLocalRunner() *LocalRunner
func (r *LocalRunner) GetName() string {
	name, err := os.Hostname()
	if err != nil {
		panic("could not read hostname using os.Hostname") // seems very unlikely this would fail on the systems we're running on
	}
	return "local-runner" + name
}

func (*LocalRunner) DataRoot

func (l *LocalRunner) DataRoot() string

func (*LocalRunner) Loop

func (r *LocalRunner) Loop(ctx context.Context) (bool, error)

func (*LocalRunner) OnCreateAgent added in v0.2.6

func (r *LocalRunner) OnCreateAgent(spec *client.CreateAgent)

Local runners understand their "entrypoint" field to be a shell command to execute.

Calls to OnCreateAgent will execute in their own goroutine when using a CoreRunner

func (*LocalRunner) Setup

func (r *LocalRunner) Setup() error

Fulfill the ManagedAgent interface TODO: these functions are boilerplate for many agents, but I can't quite crack the "right" way to abstract them away from the user at the moment. I think it reflects a bad design choice somewhere in the interface hierarchy (guessing specifically CoreRunner is whereabouts the problem is). I haven't quite dialed it.

type PythonRunner added in v0.2.6

type PythonRunner struct {
	client.CoreAgent
	// contains filtered or unexported fields
}

PythonRunner assumes it's being run in the "canonical" core container or a similar environment. We assume we have access to some sort of environment management like conda or micromamba.

func NewPythonRunner added in v0.2.6

func NewPythonRunner() *PythonRunner

func (*PythonRunner) DataRoot added in v0.2.6

func (l *PythonRunner) DataRoot() string

func (*PythonRunner) Loop added in v0.2.6

func (r *PythonRunner) Loop(ctx context.Context) (bool, error)

func (*PythonRunner) OnCreateAgent added in v0.2.6

func (r *PythonRunner) OnCreateAgent(spec *client.CreateAgent)

Local runners understand their "entrypoint" field to be a shell command to execute.

Calls to OnCreateAgent will execute in their own goroutine when using a CoreRunner

func (*PythonRunner) Setup added in v0.2.6

func (r *PythonRunner) Setup() error

Fulfill the ManagedAgent interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳