containerdtracker

package
v0.3.32 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

Containerd Tracker

Introduction

Containerd Tracker provides an implementation of the DRMAA2 JobTracker interface for managing containers with containerd. It allows you to use the DRMAA2 interface to create, control, and manage containerd containers as jobs. The package also contains implementations for managing container lifecycles, getting container information, and mapping container states to DRMAA2 job states.

Functionality

Containerd Tracker provides an API to manage containerd containers as jobs using the DRMAA2 interface. It offers the following functionality:

  1. Creating and starting containerd containers using the DRMAA2 JobTemplate. The container image and command to run within the container are specified in the JobCategory and Args fields of the JobTemplate, respectively.

  2. Listing all containerd containers and their corresponding job IDs.

  3. Providing job control functions such as suspend, resume, and terminate for managing containerd containers.

  4. Mapping DRMAA2 Job Control commands to corresponding containerd actions for seamless integration.

  5. Mapping DRMAA2 JobState to containerd state to provide a consistent view of the container's status.

  6. Retrieving container information and mapping it to the DRMAA2 JobInfo struct.

Please note that some DRMAA2 features, such as Hold, Release, and Job Arrays, are not supported in the Containerd Tracker due to limitations in containerd.

Basic Usage

To use Containerd Tracker, you'll need to create a new ContainerdJobTracker instance with the containerd address:

tracker, err := containerdtracker.NewContainerdJobTracker("/run/containerd/containerd.sock")

A JobTemplate requires:

  • JobCategory -> which maps to the container image to be used
  • Args -> which is the command to be executed within the given container image
Job Control Mapping
DRMAA2 Job Control Containerd Action
Suspend Pause
Resume Resume
Terminate Kill (SIGTERM)
State Mapping
DRMAA2 State Containerd State
Queued Created
Running Running, Pausing
Suspended Paused
Done Stopped - Exit code 0
Failed Stopped - Exit code != 0
Undetermined other

Job Info

The Containerd Tracker provides an implementation to retrieve container information and map it to the DRMAA2 JobInfo struct. Some fields may not be directly available from containerd and might require further customization based on your specific requirements.

Job Arrays

Job Arrays are not supported in the Containerd Tracker due to limitations in containerd. However, you can implement job arrays by manually creating multiple tasks sequentially in a loop.

Testing

The Containerd Tracker includes Ginkgo tests that can be run to ensure proper functionality. To run the tests, make sure you have Ginkgo and Gomega installed, and then execute ginkgo in the package directory.

Limitations

The Containerd Tracker has some limitations, including:

  • It does not support DRMAA2 Hold and Release actions.
  • Job Arrays are not natively supported in containerd and must be implemented manually.
  • Some JobTemplate fields may require additional customization to work seamlessly with containerd configurations.

Despite these limitations, the Containerd Tracker provides a convenient way to use the DRMAA2 interface for managing containerd containers as jobs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerdJobTracker added in v0.3.26

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

ContainerdJobTracker implements the JobTracker interface for containerd.

func NewContainerdJobTracker added in v0.3.26

func NewContainerdJobTracker(containerdAddr string) (*ContainerdJobTracker, error)

NewContainerdJobTracker creates a new ContainerdJobTracker instance with the given containerd address.

func (*ContainerdJobTracker) AddArrayJob added in v0.3.26

func (t *ContainerdJobTracker) AddArrayJob(jt drmaa2interface.JobTemplate, begin int, end int, step int, maxParallel int) (string, error)

func (*ContainerdJobTracker) AddJob added in v0.3.26

func (*ContainerdJobTracker) DeleteJob added in v0.3.26

func (t *ContainerdJobTracker) DeleteJob(jobID string) error

func (*ContainerdJobTracker) JobControl added in v0.3.26

func (t *ContainerdJobTracker) JobControl(jobID, action string) error

func (*ContainerdJobTracker) JobInfo added in v0.3.26

func (*ContainerdJobTracker) JobState added in v0.3.26

func (*ContainerdJobTracker) ListArrayJobs added in v0.3.26

func (t *ContainerdJobTracker) ListArrayJobs(arrayjobID string) ([]string, error)

func (*ContainerdJobTracker) ListJobCategories added in v0.3.26

func (t *ContainerdJobTracker) ListJobCategories() ([]string, error)

func (*ContainerdJobTracker) ListJobs added in v0.3.26

func (t *ContainerdJobTracker) ListJobs() ([]string, error)

func (*ContainerdJobTracker) Wait added in v0.3.26

func (t *ContainerdJobTracker) Wait(jobID string, timeout time.Duration, state ...drmaa2interface.JobState) error

Jump to

Keyboard shortcuts

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