duckdb

package
v0.0.0-...-380da73 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Job phases
	JobPhasePending  JobPhase = "Pending"
	JobPhaseRunning  JobPhase = "Running"
	JobPhaseComplete JobPhase = "Complete"
	JobPhaseFailed   JobPhase = "Failed"

	// JobHistoryLimit is the number of completed/failed jobs to keep
	JobHistoryLimit = 3

	// JobTimeoutDuration is the default timeout for jobs
	JobTimeoutDuration = 30 * time.Minute

	// JobCleanupAge is the age after which completed/failed jobs are cleaned up
	JobCleanupAge = 24 * time.Hour
)

Variables

This section is empty.

Functions

func CreateBackupJob

func CreateBackupJob(catalog *ducklakev1alpha1.DuckLakeCatalog, backupPath string) (*batchv1.Job, error)

CreateBackupJob creates a job to backup a catalog

func GetJobCondition

func GetJobCondition(job *batchv1.Job, condType batchv1.JobConditionType) *batchv1.JobCondition

GetJobCondition returns the condition of the given type from the job status

func GetJobMessage

func GetJobMessage(job *batchv1.Job) string

GetJobMessage returns a human-readable message describing the job's state

func IsJobActive

func IsJobActive(job *batchv1.Job) bool

IsJobActive returns true if the job is still running

func IsJobComplete

func IsJobComplete(job *batchv1.Job) bool

IsJobComplete checks if a job is complete

func IsJobFailed

func IsJobFailed(job *batchv1.Job) bool

IsJobFailed checks if a job has failed

func IsJobTimedOut

func IsJobTimedOut(job *batchv1.Job) bool

IsJobTimedOut returns true if the job has exceeded its timeout

Types

type JobConfig

type JobConfig struct {
	ReadOnly        bool
	Resources       corev1.ResourceRequirements
	SecurityContext *corev1.SecurityContext
	InitContainers  []corev1.Container
	Sidecars        []corev1.Container
	Volumes         []corev1.Volume
	VolumeMounts    []corev1.VolumeMount
	EnvFrom         []corev1.EnvFromSource
	Env             []corev1.EnvVar
}

JobConfig contains the configuration for a DuckDB job

func DefaultReadJobConfig

func DefaultReadJobConfig() *JobConfig

DefaultReadJobConfig returns the default configuration for read jobs

func DefaultWriteJobConfig

func DefaultWriteJobConfig() *JobConfig

DefaultWriteJobConfig returns the default configuration for write jobs

func (*JobConfig) AddEnv

func (c *JobConfig) AddEnv(env []corev1.EnvVar)

AddEnv adds environment variables to the configuration

func (*JobConfig) AddEnvFrom

func (c *JobConfig) AddEnvFrom(envFrom []corev1.EnvFromSource)

AddEnvFrom adds environment from sources to the configuration

func (*JobConfig) AddVolumeMounts

func (c *JobConfig) AddVolumeMounts(mounts []corev1.VolumeMount)

AddVolumeMounts adds volume mounts to the configuration

func (*JobConfig) AddVolumes

func (c *JobConfig) AddVolumes(volumes []corev1.Volume)

AddVolumes adds volumes to the configuration

func (*JobConfig) SetResources

func (c *JobConfig) SetResources(resources corev1.ResourceRequirements)

SetResources sets the resource requirements

func (*JobConfig) SetSecurityContext

func (c *JobConfig) SetSecurityContext(securityContext *corev1.SecurityContext)

SetSecurityContext sets the security context

type JobManager

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

JobManager manages DuckDB job operations

func NewJobManager

func NewJobManager(k8sClient kubernetes.Interface) *JobManager

NewJobManager creates a new job manager

func (*JobManager) CreateJob

func (m *JobManager) CreateJob(op *Operation) (*batchv1.Job, error)

CreateJob creates a Kubernetes Job for a DuckDB operation

type JobPhase

type JobPhase string

JobPhase represents the phase of a job

type JobState

type JobState struct {
	Phase          JobPhase
	StartTime      *metav1.Time
	CompletionTime *metav1.Time
	Failed         bool
	Active         bool
	Succeeded      bool
	Message        string
	Conditions     []batchv1.JobCondition
}

JobState represents the state of a job

type LifecycleManager

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

LifecycleManager manages the lifecycle of DuckDB jobs

func NewLifecycleManager

func NewLifecycleManager(client client.Client, kubeClient kubernetes.Interface) *LifecycleManager

NewLifecycleManager creates a new job lifecycle manager

func (*LifecycleManager) CleanupJobs

func (m *LifecycleManager) CleanupJobs(ctx context.Context, namespace string, selector labels.Selector) error

CleanupJobs removes old completed/failed jobs

func (*LifecycleManager) GetJobLogs

func (m *LifecycleManager) GetJobLogs(ctx context.Context, job *batchv1.Job) (map[string]string, error)

GetJobLogs returns logs from all pods associated with a job

func (*LifecycleManager) GetJobPods

func (m *LifecycleManager) GetJobPods(ctx context.Context, job *batchv1.Job) ([]corev1.Pod, error)

GetJobPods returns all pods associated with a job

func (*LifecycleManager) GetJobState

func (m *LifecycleManager) GetJobState(ctx context.Context, job *batchv1.Job) (*JobState, error)

GetJobState returns the current state of a job

func (*LifecycleManager) WaitForJobCompletion

func (m *LifecycleManager) WaitForJobCompletion(ctx context.Context, job *batchv1.Job) (*JobState, error)

WaitForJobCompletion waits for a job to complete with retries

type Operation

type Operation struct {
	metav1.TypeMeta
	metav1.ObjectMeta
	Type          OperationType
	SQL           string
	Table         *ducklakev1alpha1.DuckLakeTable
	Catalog       *ducklakev1alpha1.DuckLakeCatalog
	PodTemplate   *config.PodTemplateConfig
	JobNameSuffix string
}

Operation represents a DuckDB operation configuration

func (*Operation) CreateJob

func (op *Operation) CreateJob() (*batchv1.Job, error)

CreateJob creates a Kubernetes Job for a DuckDB operation

func (*Operation) DeepCopyInto

func (o *Operation) DeepCopyInto(out *Operation)

DeepCopyInto copies all properties of this object into another object of the same type

func (*Operation) DeepCopyObject

func (o *Operation) DeepCopyObject() runtime.Object

DeepCopyObject implements runtime.Object

func (*Operation) GetObjectStoreEnv

func (op *Operation) GetObjectStoreEnv() []corev1.EnvVar

GetObjectStoreEnv returns environment variables for object store configuration

type OperationType

type OperationType string

OperationType represents the type of DuckDB operation

const (
	// OperationTypeRead represents a read-only operation
	OperationTypeRead OperationType = "read"
	// OperationTypeWrite represents a write operation
	OperationTypeWrite OperationType = "write"
)

Jump to

Keyboard shortcuts

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