config

package
v0.9.263 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: AGPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DIR_NAME   = ".cedana"
	FILE_NAME  = "config"
	FILE_TYPE  = "json"
	DIR_PERM   = 0o755
	FILE_PERM  = 0o644
	ENV_PREFIX = "CEDANA"

	// NOTE: `localhost` server inside kubernetes may or may not work
	// based on firewall and network configuration, it would only work
	// on local system, hence for serving on TCP default is 0.0.0.0
	DEFAULT_TCP_ADDR   = "0.0.0.0:8080"
	DEFAULT_SOCK_ADDR  = "/run/cedana.sock"
	DEFAULT_SOCK_PERMS = 0o666

	DEFAULT_PROTOCOL            = "unix"
	DEFAULT_LOG_LEVEL           = "info"
	DEFAULT_LOG_LEVEL_NO_SERVER = "warn"

	DEFAULT_CHECKPOINT_COMPRESSION = "none"
	DEFAULT_CHECKPOINT_DIR         = "/tmp"
	DEFAULT_CHECKPOINT_STREAMS     = 0

	DEFAULT_DB_REMOTE = false
	DEFAULT_DB_PATH   = "/tmp/cedana.db"

	DEFAULT_PROFILING_ENABLED   = true
	DEFAULT_PROFILING_PRECISION = "auto"

	DEFAULT_CONNECTION_URL        = "https://sandbox.cedana.ai"
	DEFAULT_CONNECTION_AUTH_TOKEN = ""

	DEFAULT_METRICS = false

	DEFAULT_CLIENT_WAIT_FOR_READY = false

	DEFAULT_GPU_POOL_SIZE   = 0
	DEFAULT_GPU_LOG_DIR     = "/tmp"
	DEFAULT_GPU_SOCK_DIR    = "/tmp"
	DEFAULT_GPU_FREEZE_TYPE = "IPC"
	DEFAULT_GPU_SHM_SIZE    = 8 * utils.GIBIBYTE
	DEFAULT_GPU_DEBUG       = false

	DEFAULT_CRIU_LEAVE_RUNNING  = false
	DEFAULT_CRIU_MANAGE_CGROUPS = "default"

	DEFAULT_PLUGINS_LIB_DIR = "/usr/local/lib"
	DEFAULT_PLUGINS_BIN_DIR = "/usr/local/bin"
	DEFAULT_PLUGINS_BUILDS  = "release"
)

Variables

This section is empty.

Functions

func Init

func Init(args InitArgs) error

Types

type AWS added in v0.9.257

type AWS struct {
	// AccessKeyID is the AWS access key ID
	AccessKeyID string `json:"access_key_id" key:"access_key_id" yaml:"access_key_id" mapstructure:"access_key_id" env_aliases:"AWS_ACCESS_KEY_ID"`
	// SecretAccessKey is the AWS secret access key
	SecretAccessKey string `` /* 142-byte string literal not displayed */
	// Region is the AWS region to use (uses default region if not set)
	Region string `json:"region" key:"region" yaml:"region" mapstructure:"region" env_aliases:"AWS_REGION"`
}

type CRIU

type CRIU struct {
	// BinaryPath is a custom path to the CRIU binary
	BinaryPath string `json:"binary_path" key:"binary_path" yaml:"binary_path" mapstructure:"binary_path"`
	// LeaveRunning sets whether to leave the process running after checkpoint
	LeaveRunning bool `json:"leave_running" key:"leave_running" yaml:"leave_running" mapstructure:"leave_running"`
	// ManageCgroups sets the default cgroup C/R mode for CRIU (default, cg_none, props, soft, full, strict, ignore)
	ManageCgroups string `json:"manage_cgroups" key:"manage_cgroups" yaml:"manage_cgroups" mapstructure:"manage_cgroups"`
}

type Checkpoint

type Checkpoint struct {
	// Dir is the default directory to store checkpoints
	// - "cedana://<path>" for Cedana-managed global storage (recommended)
	// - "s3://<path>" for your S3 storage
	// - "<path>" for node-local storage
	Dir string `json:"dir" key:"dir" yaml:"dir" mapstructure:"dir"`
	// Compression is the default compression algorithm to use for checkpoints
	Compression string `json:"compression" key:"compression" yaml:"compression" mapstructure:"compression"`
	// Streams specifies the number of parallel streams to use when checkpointing.
	Streams int32 `json:"streams" key:"streams" yaml:"streams" mapstructure:"streams"`
}

type Client

type Client struct {
	// Wait for ready ensures client requests block if the daemon is not up yet
	WaitForReady bool `` /* 130-byte string literal not displayed */
}

type Config

type Config struct {
	// Address to use for incoming/outgoing connections
	Address string `json:"address" key:"address" yaml:"address" mapstructure:"address"`
	// Protocol to use for incoming/outgoing connections (TCP, UNIX, VSOCK)
	Protocol string `json:"protocol" key:"protocol" yaml:"protocol" mapstructure:"protocol"`
	// LogLevel is the default log level used by the server
	LogLevel string `json:"log_level" key:"log_level" yaml:"log_level" mapstructure:"log_level"`
	// LogLevelNoServer is the log level used when direct --no-server run/restore is used. This is separate from LogLevel so as to avoid cluttering the process output.
	LogLevelNoServer string `json:"log_level_no_server" key:"log_level_no_server" yaml:"log_level_no_server" mapstructure:"log_level_no_server"`
	// Metrics is whether to enable metrics collection and observability
	Metrics bool `json:"metrics" key:"metrics" yaml:"metrics" mapstructure:"metrics"`

	// Connection settings
	Connection Connection `json:"connection" key:"connection" yaml:"connection" mapstructure:"connection"`
	// Checkpoint and storage settings
	Checkpoint Checkpoint `json:"checkpoint" key:"checkpoint" yaml:"checkpoint" mapstructure:"checkpoint"`
	// Database details
	DB DB `json:"db" key:"db" yaml:"db" mapstructure:"db"`
	// Profiling settings
	Profiling Profiling `json:"profiling" key:"profiling" yaml:"profiling" mapstructure:"profiling"`
	// Client settings
	Client Client `json:"client" key:"client" yaml:"client" mapstructure:"client"`
	// CRIU settings and defaults
	CRIU CRIU `json:"criu" key:"criu" yaml:"criu" mapstructure:"criu"`
	// GPU is settings for the GPU plugin
	GPU GPU `json:"gpu" key:"gpu" yaml:"gpu" mapstructure:"gpu"`
	// Plugin settings
	Plugins Plugins `json:"plugins" key:"plugins" yaml:"plugins" mapstructure:"plugins"`

	// AWS settings
	AWS AWS `json:"aws" key:"aws" yaml:"aws" mapstructure:"aws"`
}

Cedana configuration. Each of the below fields can also be set through an environment variable with the same name, prefixed, and in uppercase. E.g. `Checkpoint.Dir` can be set with `CEDANA_CHECKPOINT_DIR`. The `env_aliases` tag below specifies alternative (alias) environment variable names (comma-separated).

var Global Config = Config{

	Protocol:         DEFAULT_PROTOCOL,
	LogLevel:         DEFAULT_LOG_LEVEL,
	LogLevelNoServer: DEFAULT_LOG_LEVEL_NO_SERVER,
	Metrics:          DEFAULT_METRICS,
	Checkpoint: Checkpoint{
		Dir:         DEFAULT_CHECKPOINT_DIR,
		Compression: DEFAULT_CHECKPOINT_COMPRESSION,
		Streams:     DEFAULT_CHECKPOINT_STREAMS,
	},
	DB: DB{
		Remote: DEFAULT_DB_REMOTE,
		Path:   DEFAULT_DB_PATH,
	},
	Profiling: Profiling{
		Enabled:   DEFAULT_PROFILING_ENABLED,
		Precision: DEFAULT_PROFILING_PRECISION,
	},
	Connection: Connection{
		URL:       DEFAULT_CONNECTION_URL,
		AuthToken: DEFAULT_CONNECTION_AUTH_TOKEN,
	},
	Client: Client{
		WaitForReady: DEFAULT_CLIENT_WAIT_FOR_READY,
	},
	GPU: GPU{
		PoolSize:   DEFAULT_GPU_POOL_SIZE,
		LogDir:     DEFAULT_GPU_LOG_DIR,
		SockDir:    DEFAULT_GPU_SOCK_DIR,
		FreezeType: DEFAULT_GPU_FREEZE_TYPE,
		ShmSize:    DEFAULT_GPU_SHM_SIZE,
		Debug:      DEFAULT_GPU_DEBUG,
	},
	CRIU: CRIU{
		LeaveRunning:  DEFAULT_CRIU_LEAVE_RUNNING,
		ManageCgroups: DEFAULT_CRIU_MANAGE_CGROUPS,
	},
	Plugins: Plugins{
		LibDir: DEFAULT_PLUGINS_LIB_DIR,
		BinDir: DEFAULT_PLUGINS_BIN_DIR,
		Builds: DEFAULT_PLUGINS_BUILDS,
	},
}

The default global config. This will get overwritten by the config file or env vars during startup, if they exist.

type Connection

type Connection struct {
	// URL is your unique Cedana endpoint URL
	URL string `json:"url" key:"url" yaml:"url" mapstructure:"url" env_aliases:"CEDANA_URL"`
	// AuthToken is your authentication token for the Cedana endpoint
	AuthToken string `json:"auth_token" key:"auth_token" yaml:"auth_token" mapstructure:"auth_token" env_aliases:"CEDANA_AUTH_TOKEN"`
}

type DB

type DB struct {
	// Remote sets whether to use a remote database
	Remote bool `json:"remote" key:"remote"  yaml:"remote" mapstructure:"remote" env_aliases:"CEDANA_REMOTE"`
	// Path is the local path to the database file. E.g. /tmp/cedana.db
	Path string `json:"path" key:"path" yaml:"path" mapstructure:"path"`
}

type GPU

type GPU struct {
	// Number of warm GPU controllers to keep in pool
	PoolSize int `json:"pool_size" key:"pool_size" yaml:"pool_size" mapstructure:"pool_size"`
	// LogDir is the directory to write GPU logs to
	LogDir string `json:"log_dir" key:"log_dir" yaml:"log_dir" mapstructure:"log_dir"`
	// SockDir is the directory to use for the GPU sockets
	SockDir string `json:"sock_dir" key:"sock_dir" yaml:"sock_dir" mapstructure:"sock_dir"`
	// Track metrics associated with observability
	Observability bool `json:"observability" key:"observability" yaml:"observability" mapstructure:"observability"`
	// FreezeType is the type of freeze to use for GPU processes (IPC, NCCL)
	FreezeType string `json:"freeze_type" key:"freeze_type" yaml:"freeze_type" mapstructure:"freeze_type"`
	// ShmSize is the size in bytes of the shared memory segment to use for GPU processes
	ShmSize int64 `json:"shm_size" key:"shm_size" yaml:"shm_size" mapstructure:"shm_size"`
	// LdLibPath holds any additional directories to search for GPU libraries
	LdLibPath string `json:"ld_lib_path" key:"ld_lib_path" yaml:"ld_lib_path" mapstructure:"ld_lib_path"`
	// Debug enables debugging capabilities for the GPU plugin. Daemon will try to attach to existing running GPU controllers
	Debug bool `json:"debug" key:"debug" yaml:"debug" mapstructure:"debug"`
}

type InitArgs

type InitArgs struct {
	Config    string
	ConfigDir string
}

type Plugins

type Plugins struct {
	// BinDir is the directory where plugin binaries are stored
	BinDir string `json:"bin_dir" key:"bin_dir" yaml:"bin_dir" mapstructure:"bin_dir"`
	// LibDir is the directory where plugin libraries are stored
	LibDir string `json:"lib_dir" key:"lib_dir" yaml:"lib_dir" mapstructure:"lib_dir" env_aliases:"CEDANA_PLUGINS_LIB_DIR"`
	// Builds is the build versions to list/download for plugins (release, alpha)
	Builds string `json:"builds" key:"builds" yaml:"builds" mapstructure:"builds"`
}

type Profiling

type Profiling struct {
	// Enabled sets whether to enable and show profiling information
	Enabled bool `json:"enabled" key:"enabled" yaml:"enabled" mapstructure:"enabled"`
	// Precision sets the time precision when printing profiling information (auto, ns, us, ms, s)
	Precision string `json:"precision" key:"precision" yaml:"precision" mapstructure:"precision"`
}

Jump to

Keyboard shortcuts

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