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 ¶
Job represents a container job managed by a runtime.
func GetJobs ¶ added in v1.0.38
func GetJobs(ctx context.Context, provider Provider, client *p42.Client, tenantID string, verbose bool, includeCompleted bool) ([]*Job, error)
GetJobs returns a fully populated, sorted list of jobs. It performs the following steps: 1. Gets running job IDs from provider. 2. Optionally gets completed job IDs from provider. 3. Fetches job data from the API (TaskTitle, CreatedDate). 4. Sorts by CreatedDate (descending), TaskTitle, TaskID.
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
// GetRunningJobIDs returns IDs of all running jobs managed by this runtime.
GetRunningJobIDs(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.