executor

package
v0.0.0-...-e238554 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EvalWrapperScript = "_pyexec_eval.py"

EvalWrapperScript is the name of the wrapper script for REPL-style evaluation

View Source
const ResultMarker = "___PYEXEC_RESULT___"

ResultMarker is the delimiter used to identify the expression result in stdout

Variables

This section is empty.

Functions

func GetEvalWrapperCode

func GetEvalWrapperCode() string

GetEvalWrapperCode returns the Python wrapper code for REPL-style evaluation

Types

type DockerExecutor

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

DockerExecutor implements the Executor interface using Docker

func NewDockerExecutor

func NewDockerExecutor(cfg *config.Config) (*DockerExecutor, error)

NewDockerExecutor creates a new Docker-based executor

func (*DockerExecutor) Close

func (e *DockerExecutor) Close() error

Close closes the Docker client

func (*DockerExecutor) Execute

Execute runs code in a Docker container

func (*DockerExecutor) Kill

func (e *DockerExecutor) Kill(ctx context.Context, containerID string) error

Kill terminates a running container

type ExecutionOutput

type ExecutionOutput struct {
	Stdout     string
	Stderr     string
	ExitCode   int
	DurationMs int64
}

ExecutionOutput contains the execution results

type ExecutionRequest

type ExecutionRequest struct {
	ID       string
	TarData  []byte
	Metadata *client.Metadata
}

ExecutionRequest contains all data needed for execution

type Executor

type Executor interface {
	// Execute runs code in a sandboxed environment
	Execute(ctx context.Context, req *ExecutionRequest) (*ExecutionOutput, error)

	// Kill terminates a running execution
	Kill(ctx context.Context, containerID string) error

	// Close cleans up executor resources
	Close() error
}

Executor defines the interface for code execution

Jump to

Keyboard shortcuts

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