runtime

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package runtime defines interfaces for job runtime providers. It enables the CLI to support multiple runtimes (Apple container, Podman) through a common abstraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	TaskID      string
	TurnIndex   int
	Running     bool
	TaskTitle   string
	CreatedDate time.Time
}

Job represents a container job managed by a runtime.

type JobOptions

type JobOptions struct {
	JobID      string
	Image      string
	CPUs       int // Required. Number of CPUs to allocate.
	Memory     int // Required. Memory in whole gigabytes.
	Entrypoint string
	Args       []string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	LogPath    string
}

JobOptions specifies the configuration for running a job.

type Provider

type Provider interface {
	// Name returns the configuration name (e.g., "apple", "podman") of the provider.
	Name() string
	// IsInstalled reports whether the runtime is available on the system.
	IsInstalled() bool
	// Validate checks that the runtime is properly configured and functional.
	Validate(ctx context.Context) error

	// PullImage pulls the specified container image.
	PullImage(ctx context.Context, image string) error

	// RunJob runs a job with the specified options.
	RunJob(ctx context.Context, opts JobOptions) error

	// KillJob terminates the job with the given ID.
	KillJob(ctx context.Context, jobID string) error

	// GetRunningContainerIDs returns IDs of all running containers managed by this runtime.
	GetRunningContainerIDs(ctx context.Context) ([]string, error)
	// GetCompletedJobIDs returns IDs of all completed jobs with log files.
	GetCompletedJobIDs() ([]string, error)

	// ValidateJobID checks if the given job ID is valid for this runtime.
	ValidateJobID(jobID string) error

	// DeleteJobLog removes the log file for the specified job.
	DeleteJobLog(jobID string) error
}

Provider defines the interface for job runtime implementations. Each supported runtime (Apple container, Podman) must implement this interface.

Jump to

Keyboard shortcuts

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