plugins

package
v0.9.310 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BINARY_PERMS       = 0o755
	LIBRARY_PERMS      = 0o644
	DOWNLOAD_DIR_PERMS = 0o755
)
View Source
const VERSION_ATTRIBUTE_PREFIX = "cedana.plugin."
View Source
const VERSION_ATTRIBUTE_SUFFIX = ".version"

Variables

View Source
var LibDir, BinDir string
View Source
var Load = sync.OnceValue(loadPlugins)
View Source
var Registry = []Plugin{

	{
		Name:     "criu",
		Type:     EXTERNAL,
		Binaries: []Binary{{Name: "criu"}},
	},
	{
		Name:      "cloud-hypervisor",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-cloud-hypervisor.so"}},
	},
	{
		Name:      "criu/cuda",
		Type:      EXTERNAL,
		Binaries:  []Binary{{Name: "cuda-checkpoint", InstallDir: "/usr/local/bin"}},
		Libraries: []Binary{{Name: "cuda_plugin.so", InstallDir: "/usr/lib/criu"}},
	},
	{
		Name:      "criu/nvidia-dev",
		Type:      EXTERNAL,
		Libraries: []Binary{{Name: "nvidia-dev-plugin.so", InstallDir: "/usr/lib/criu"}},
	},
	{
		Name:      "criu/infiniband",
		Type:      EXTERNAL,
		Libraries: []Binary{{Name: "infiniband-plugin.so", InstallDir: "/usr/lib/criu"}},
	},

	{
		Name:      "runc",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-runc.so"}},
	},
	{
		Name:      "crun",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-crun.so"}},
	},
	{
		Name:      "containerd",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-containerd.so"}},
	},
	{
		Name:      "crio",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-crio.so"}},
	},
	{
		Name:      "kata",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-kata.so"}},
	},

	{
		Name:      "storage/cedana",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-storage-cedana.so"}},
	},
	{
		Name:      "storage/s3",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-storage-s3.so"}},
	},
	{
		Name:      "storage/gcs",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-storage-gcs.so"}},
	},
	{
		Name:      "storage/csx",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-storage-csx.so"}},
	},

	{
		Name:      "gpu",
		Type:      EXTERNAL,
		Libraries: []Binary{{Name: "libcedana-gpu.so"}},
		Binaries:  []Binary{{Name: "cedana-gpu-controller"}},
	},
	{
		Name:      "gpu/tracer",
		Type:      EXTERNAL,
		Libraries: []Binary{{Name: "libcedana-gpu-tracer.so"}},
	},
	{
		Name:     "streamer",
		Type:     EXTERNAL,
		Binaries: []Binary{{Name: "cedana-image-streamer"}},
	},
	{
		Name:      "k8s",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-k8s.so"}},
		Binaries:  []Binary{},
	},
	{
		Name:      "containerd/runtime-runc",
		Type:      EXTERNAL,
		Libraries: []Binary{},
		Binaries:  []Binary{{Name: "cedana-shim-runc-v2"}},
	},
	{
		Name:      "slurm",
		Type:      SUPPORTED,
		Libraries: []Binary{{Name: "libcedana-slurm.so"}},
	},
	{
		Name: "slurm/wlm",
		Type: EXTERNAL,
		Libraries: []Binary{
			{Name: "spank_cedana.so"},
			{Name: "task_cedana.so"},
			{Name: "cli_filter_cedana.so"},
			{Name: "job_submit_cedana.so"},
		},
		Binaries: []Binary{{Name: "cedana-slurm"}},
	},
	{
		Name:     "slurm/tests",
		Type:     EXTERNAL,
		Binaries: []Binary{{Name: "test-preemption.sh"}},
	},
	{
		Name:     "csx",
		Type:     EXTERNAL,
		Binaries: []Binary{{Name: "csx"}},
	},
}

Local registry of plugins that are supported by Cedana XXX: This list is needed locally so when all plugins are loaded, we only want to attempt to load the ones that are 'Supported'. GPU plugin, for example, is not 'External' and thus cannot be loaded by Go, so we shouldn't try, as it's undefined behavior.

Functions

func InstalledVersionAttributes added in v0.9.309

func InstalledVersionAttributes(manager Manager) map[string]string

InstalledVersionAttributes returns InstalledVersions keyed by attribute key.

func InstalledVersions added in v0.9.309

func InstalledVersions(manager Manager) map[string]string

InstalledVersions returns a map of plugin name to installed version for every plugin the manager reports as installed. Plugins whose version cannot be determined are reported as "unknown", so that their presence is still visible.

func RecoverFromPanic

func RecoverFromPanic(plugin string)

RecoverFromPanic is a helper function to recover from panics in plugins and log the error. It should only be used with defer.

func VersionAttributeKey added in v0.9.309

func VersionAttributeKey(name string) string

VersionAttributeKey returns the attribute key under which a plugin's version is reported, e.g. "cedana.plugin.gpu.version" or "cedana.plugin.criu.cuda.version".

Types

type Binary

type Binary struct {
	Name       string `json:"name"`
	Checksum   string `json:"checksum"`     // CRC32
	InstallDir string `json:"install_path"` // Fixed path where the binary must be installed
}

type Feature

type Feature[T any] struct {
	Symbol      string
	Description string
}

Feature is a typed symbol that a plugin can export with a description of what it does/used for.

func (Feature[T]) IfAvailable

func (feature Feature[T]) IfAvailable(
	do func(pluginName string, sym T) error,
	filter ...string,
) error

IfAvailable checks if a feature is available in any of the plugins, and if it is, it calls the provided function with the plugin name and the feature. Always goes through all plugins, even if one of them fails. Later, the errors are returned together, if any. If no filter is provided, all plugins are checked.

func (Feature[T]) IsAvailable

func (feature Feature[T]) IsAvailable(filter ...string) (bool, error)

IsAvailable checks if a feature is available in any of the plugins. If no filter is provided, all plugins are checked. Also returns an error if the symbol is present but incompatible.

func (Feature[T]) String

func (feature Feature[T]) String() string

type LocalManager

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

func NewLocalManager

func NewLocalManager() *LocalManager

func (*LocalManager) Get

func (m *LocalManager) Get(name string) *Plugin

func (*LocalManager) Getf added in v0.9.268

func (m *LocalManager) Getf(format string, a ...any) *Plugin

func (*LocalManager) Install

func (m *LocalManager) Install(names []string) (chan int, chan string, chan error)

func (*LocalManager) IsInstalled

func (m *LocalManager) IsInstalled(name string) bool

func (*LocalManager) List

func (m *LocalManager) List(latest bool, filter ...string) (list []Plugin, err error)

List returns a list of plugins that are available. If filter is provided, only plugins with the specified names are returned.

func (*LocalManager) Remove

func (m *LocalManager) Remove(names []string) (chan int, chan string, chan error)

type Manager

type Manager interface {
	// List all plugins
	List(latest bool, filter ...string) ([]Plugin, error)

	// Install a list of plugins
	Install(names []string) (installed chan int, msgs chan string, errs chan error)

	// Remove a list of plugins
	Remove(names []string) (removed chan int, msgs chan string, errs chan error)

	// Get a plugin by name
	Get(name string) *Plugin

	//  Get by formatted name
	Getf(format string, a ...any) *Plugin

	// Check if a plugin is installed
	IsInstalled(name string) bool
}

type ManagerUnimplemented

type ManagerUnimplemented struct{}

func (*ManagerUnimplemented) Get

func (m *ManagerUnimplemented) Get(_ string) *Plugin

func (*ManagerUnimplemented) Getf added in v0.9.268

func (m *ManagerUnimplemented) Getf(format string, a ...any) *Plugin

func (*ManagerUnimplemented) Install

func (m *ManagerUnimplemented) Install(_ []string) (chan int, chan string, chan error)

func (*ManagerUnimplemented) IsInstalled

func (m *ManagerUnimplemented) IsInstalled(_ string) bool

func (*ManagerUnimplemented) List

func (m *ManagerUnimplemented) List(_ ...Status) ([]Plugin, error)

func (*ManagerUnimplemented) Remove

func (m *ManagerUnimplemented) Remove(_ []string) (chan int, chan string, chan error)

type Plugin

type Plugin struct {
	Name             string    `json:"name"`
	Type             Type      `json:"type"`
	Status           Status    `json:"status"`
	Version          string    `json:"version"`
	AvailableVersion string    `json:"latest_version"`
	Libraries        []Binary  `json:"libraries"`
	Binaries         []Binary  `json:"binaries"`
	Size             int64     `json:"size"` // in bytes
	PublishedAt      time.Time `json:"published_at"`
}

Represents plugin information

func (*Plugin) BinaryPaths

func (p *Plugin) BinaryPaths() []string

BinaryPaths returns the full paths of the plugin binaries

func (*Plugin) Checksum

func (p *Plugin) Checksum() string

Checksum returns the concatenated checksum of all libraries and binaries

func (*Plugin) IsInstalled

func (p *Plugin) IsInstalled() bool

func (*Plugin) LibraryPaths

func (p *Plugin) LibraryPaths() []string

LibraryPaths returns the full paths of the plugin libraries

func (*Plugin) SyncInstalled

func (p *Plugin) SyncInstalled()

Syncs plugin information with local info, whether it is installed or not. Also fetches the local installed version.

func (*Plugin) SyncVersion

func (p *Plugin) SyncVersion()

SyncVersion fetches the version of the locally installed plugin

type PropagatorManager

type PropagatorManager struct {
	config.Connection

	*LocalManager
	// contains filtered or unexported fields
}

func NewPropagatorManager

func NewPropagatorManager(connection config.Connection, compatibility string) *PropagatorManager

func (*PropagatorManager) Install

func (m *PropagatorManager) Install(names []string) (chan int, chan string, chan error)

func (*PropagatorManager) List

func (m *PropagatorManager) List(latest bool, filter ...string) ([]Plugin, error)

type Status

type Status int
const (
	UNKNOWN Status = iota
	AVAILABLE
	INSTALLED
	OUTDATED
)

func (Status) String

func (s Status) String() string

type Type

type Type int
const (
	UNIMPLEMENTED Type = iota // Go plugin that is not yet implemented
	DEPRECATED                // Go plugin that is no longer maintained
	EXPERIMENTAL              // Go plugin that is not yet stable
	EXTERNAL                  // Not a Go plugin
	SUPPORTED                 // Go plugin that is supported by Cedana
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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