- Add API server with WebSocket support and REST endpoints - Implement authentication system with API keys and permissions - Add task queue system with Redis backend and error handling - Include storage layer with database migrations and schemas - Add comprehensive logging, metrics, and telemetry - Implement security middleware and network utilities - Add experiment management and container orchestration - Include configuration management with smart defaults
39 lines
844 B
Go
39 lines
844 B
Go
// Package utils provides shared utilities for the fetch_ml project.
|
|
package errors
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// DataFetchError represents an error that occurred while fetching a dataset
|
|
// from the NAS to the ML server.
|
|
type DataFetchError struct {
|
|
Dataset string
|
|
JobName string
|
|
Err error
|
|
}
|
|
|
|
func (e *DataFetchError) Error() string {
|
|
return fmt.Sprintf("failed to fetch dataset %s for job %s: %v",
|
|
e.Dataset, e.JobName, e.Err)
|
|
}
|
|
|
|
func (e *DataFetchError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
type TaskExecutionError struct {
|
|
TaskID string
|
|
JobName string
|
|
Phase string // "data_fetch", "execution", "cleanup"
|
|
Err error
|
|
}
|
|
|
|
func (e *TaskExecutionError) Error() string {
|
|
return fmt.Sprintf("task %s (%s) failed during %s: %v",
|
|
e.TaskID[:8], e.JobName, e.Phase, e.Err)
|
|
}
|
|
|
|
func (e *TaskExecutionError) Unwrap() error {
|
|
return e.Err
|
|
}
|