export

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportFormat

type ExportFormat = Format

type ExportResult

type ExportResult = Result

type Format added in v0.3.0

type Format string

Format represents different output export formats

const (
	// FormatText is the text export format.
	FormatText Format = "txt"
	// FormatJSON is the JSON export format.
	FormatJSON Format = "json"
	// FormatCSV is the CSV export format.
	FormatCSV Format = "csv"
	// FormatMarkdown is the Markdown export format.
	FormatMarkdown Format = "md"
	// FormatHTML is the HTML export format.
	FormatHTML Format = "html"
)

type JobOutputData

type JobOutputData struct {
	JobID       string    `json:"job_id"`
	JobName     string    `json:"job_name"`
	OutputType  string    `json:"output_type"` // "stdout" or "stderr"
	Content     string    `json:"content"`
	Timestamp   time.Time `json:"timestamp"`
	ExportedBy  string    `json:"exported_by"`
	ExportTime  time.Time `json:"export_time"`
	ContentSize int       `json:"content_size_bytes"`
}

JobOutputData represents the structure of job output data

type JobOutputExporter

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

JobOutputExporter handles exporting job output to various formats

func NewJobOutputExporter

func NewJobOutputExporter(defaultPath string) *JobOutputExporter

NewJobOutputExporter creates a new job output exporter

func (*JobOutputExporter) BatchExport

func (e *JobOutputExporter) BatchExport(jobs []*JobOutputData, format ExportFormat, basePath string) ([]*ExportResult, error)

BatchExport exports multiple job outputs in the specified format

func (*JobOutputExporter) BatchExportWithCallback

func (e *JobOutputExporter) BatchExportWithCallback(jobs []*JobOutputData, format ExportFormat, _ string, progressCallback func(current, total int, jobID string)) ([]*ExportResult, error)

BatchExportWithCallback exports multiple job outputs with optional progress callback

func (*JobOutputExporter) Export

func (e *JobOutputExporter) Export(data *JobOutputData, format ExportFormat, customPath string) (*ExportResult, error)

Export exports job output to a file in the specified format

func (*JobOutputExporter) ExportJobOutput

func (e *JobOutputExporter) ExportJobOutput(jobID, jobName, outputType, content string) (string, error)

ExportJobOutput exports job output to a file in the specified format

func (*JobOutputExporter) ExportSummary

func (e *JobOutputExporter) ExportSummary(results []*ExportResult) string

ExportSummary creates a summary of exported files

func (*JobOutputExporter) GetDefaultPath

func (e *JobOutputExporter) GetDefaultPath() string

GetDefaultPath returns the default export path

func (*JobOutputExporter) GetSupportedFormats

func (e *JobOutputExporter) GetSupportedFormats() []ExportFormat

GetSupportedFormats returns all supported export formats

func (*JobOutputExporter) SetDefaultPath

func (e *JobOutputExporter) SetDefaultPath(path string)

SetDefaultPath sets the default export path

func (*JobOutputExporter) StreamingBatchExport

func (e *JobOutputExporter) StreamingBatchExport(jobProvider func() (*JobOutputData, bool), format ExportFormat, _ string, progressCallback func(current int, jobID string)) ([]*ExportResult, error)

StreamingBatchExport exports jobs one at a time to minimize memory usage

type PerformanceExporter

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

PerformanceExporter handles exporting performance reports to various formats

func NewPerformanceExporter

func NewPerformanceExporter(defaultPath string) *PerformanceExporter

NewPerformanceExporter creates a new performance exporter

func (*PerformanceExporter) BatchExportReports

func (pe *PerformanceExporter) BatchExportReports(profiler *performance.Profiler, optimizer *performance.Optimizer, formats []ExportFormat) ([]*ExportResult, error)

BatchExportReports exports multiple performance reports in different formats

func (*PerformanceExporter) ExportComparison

func (pe *PerformanceExporter) ExportComparison(_, _ *PerformanceReportData, _ ExportFormat, _ string) (*ExportResult, error)

ExportComparison exports a comparison between two performance snapshots

func (*PerformanceExporter) ExportPerformanceReport

func (pe *PerformanceExporter) ExportPerformanceReport(profiler *performance.Profiler, optimizer *performance.Optimizer, format ExportFormat, customPath string) (*ExportResult, error)

ExportPerformanceReport exports a performance report in the specified format

func (*PerformanceExporter) GetDefaultPath

func (pe *PerformanceExporter) GetDefaultPath() string

GetDefaultPath returns the default export path

func (*PerformanceExporter) SetDefaultPath

func (pe *PerformanceExporter) SetDefaultPath(path string)

SetDefaultPath sets the default export path

type PerformanceReportData

type PerformanceReportData struct {
	GeneratedAt      time.Time                      `json:"generated_at"`
	ReportPeriod     string                         `json:"report_period"`
	SystemMetrics    SystemMetrics                  `json:"system_metrics"`
	OperationStats   []performance.OperationSummary `json:"operation_stats"`
	OptimizationTips []performance.Recommendation   `json:"optimization_tips"`
}

PerformanceReportData represents performance metrics for export

type Result added in v0.3.0

type Result struct {
	FilePath  string
	Format    Format
	Size      int64
	Success   bool
	Error     error
	Timestamp time.Time
}

Result contains information about the export operation

type SystemMetrics

type SystemMetrics struct {
	CPUUsage       float64       `json:"cpu_usage"`
	MemoryUsage    float64       `json:"memory_usage"`
	MemoryUsed     uint64        `json:"memory_used"`
	MemoryTotal    uint64        `json:"memory_total"`
	GoroutineCount int           `json:"goroutine_count"`
	ResponseTime   time.Duration `json:"response_time"`
}

SystemMetrics represents system-level performance metrics

type TableData added in v0.6.0

type TableData struct {
	Title      string     // e.g. "Jobs", "Nodes", "Partitions"
	Headers    []string   // column names
	Rows       [][]string // raw (uncolored) row values
	ExportedAt time.Time
}

TableData holds tabular data for export (headers + rows + metadata).

func AccountsTableData added in v0.6.0

func AccountsTableData(accounts []*dao.Account) *TableData

AccountsTableData converts a slice of accounts to TableData for export.

func JobsTableData added in v0.6.0

func JobsTableData(jobs []*dao.Job) *TableData

JobsTableData converts a slice of jobs to TableData for export.

func NodesTableData added in v0.6.0

func NodesTableData(nodes []*dao.Node) *TableData

NodesTableData converts a slice of nodes to TableData for export.

func PartitionsTableData added in v0.6.0

func PartitionsTableData(partitions []*dao.Partition) *TableData

PartitionsTableData converts a slice of partitions to TableData for export.

func QoSTableData added in v0.6.0

func QoSTableData(qosList []*dao.QoS) *TableData

QoSTableData converts a slice of QoS entries to TableData for export.

func ReservationsTableData added in v0.6.0

func ReservationsTableData(reservations []*dao.Reservation) *TableData

ReservationsTableData converts a slice of reservations to TableData for export.

func UsersTableData added in v0.6.0

func UsersTableData(users []*dao.User) *TableData

UsersTableData converts a slice of users to TableData for export.

type TableExporter added in v0.6.0

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

TableExporter exports tabular data to various file formats.

func NewTableExporter added in v0.6.0

func NewTableExporter(defaultPath string) *TableExporter

NewTableExporter creates a new TableExporter. If defaultPath is empty it defaults to ~/slurm_exports.

func (*TableExporter) Export added in v0.6.0

func (e *TableExporter) Export(td *TableData, format ExportFormat, customPath string) (*ExportResult, error)

Export writes td to a file and returns a Result. If customPath is non-empty it is used as the full output path; otherwise a timestamped filename is generated in defaultPath.

func (*TableExporter) SetDefaultPath added in v0.6.0

func (e *TableExporter) SetDefaultPath(path string)

SetDefaultPath updates the default export directory.

type TemplateData added in v0.3.0

type TemplateData struct {
	*PerformanceReportData
	MemoryUsedFormatted  string
	MemoryTotalFormatted string
	Separator            string
	GeneratedAt          string
}

TemplateData wraps PerformanceReportData with additional formatting

Jump to

Keyboard shortcuts

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