Update worker system for scheduler integration: - Worker server with scheduler registration - Configuration with scheduler endpoint support - Artifact handling with integrity verification - Container executor with supply chain validation - Local executor enhancements - GPU detection improvements (cross-platform) - Error handling with execution context - Factory pattern for executor instantiation - Hash integrity with native library support
33 lines
766 B
Go
33 lines
766 B
Go
// Package interfaces defines the contracts for worker components
|
|
package interfaces
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/jfraeys/fetch_ml/internal/queue"
|
|
)
|
|
|
|
// ExecutionEnv holds the environment for job execution
|
|
type ExecutionEnv struct {
|
|
JobDir string
|
|
OutputDir string
|
|
LogFile string
|
|
GPUEnvVar string
|
|
GPUDevicesStr string
|
|
GPUDevices []string
|
|
}
|
|
|
|
// JobExecutor defines the contract for executing jobs
|
|
type JobExecutor interface {
|
|
// Execute runs a job with the given context, task, and environment
|
|
Execute(ctx context.Context, task *queue.Task, env ExecutionEnv) error
|
|
}
|
|
|
|
// ExecutionResult holds the result of job execution
|
|
type ExecutionResult struct {
|
|
Error error
|
|
ExitCode int
|
|
Duration time.Duration
|
|
Success bool
|
|
}
|