datapilot-cli
Version:
Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform
149 lines • 4.36 kB
TypeScript
/**
* Enhanced Progress Orchestration System
* Manages complex progress reporting across multiple analyzers with aggregation and callbacks
*/
import type { ProgressState, ProgressCallback, ProgressCallbacks, ResourceMetrics, ResourceMonitor, CLIOptions } from './types';
import type { LogContext } from '../utils/logger';
/**
* Progress phase configuration for different analysis sections
*/
export interface ProgressPhaseConfig {
name: string;
weight: number;
estimatedDuration?: number;
subPhases?: Array<{
name: string;
weight: number;
}>;
}
/**
* Overall progress state across all sections
*/
export interface OverallProgressState {
currentPhase: string;
currentSection: string;
overallProgress: number;
sectionProgress: number;
phaseProgress: number;
timeElapsed: number;
estimatedTimeRemaining?: number;
sectionsCompleted: number;
totalSections: number;
memoryUsage?: number;
rowsProcessed: number;
}
/**
* Enhanced progress orchestrator with hierarchical progress tracking
*/
export declare class ProgressOrchestrator implements ResourceMonitor {
private callbacks;
private phases;
private currentPhase?;
private currentSection?;
private sectionProgress;
private phaseProgress;
private overallProgress;
private startTime;
private phaseStartTime;
private sectionStartTime;
private completedSections;
private totalSections;
private resourceMetrics;
private context;
constructor(callbacks?: ProgressCallbacks, options?: CLIOptions, context?: LogContext);
/**
* Setup default phase configurations for DataPilot sections
*/
private setupDefaultPhases;
/**
* Setup progress logging based on CLI options
*/
private setupProgressLogging;
/**
* Start monitoring for resource usage
*/
startMonitoring(context: LogContext): void;
/**
* Set the total number of sections for progress calculation
*/
setTotalSections(total: number): void;
/**
* Start a new phase with optional subphase tracking
*/
startPhase(phaseName: string, message: string): void;
/**
* Start a new section within the current phase
*/
startSection(sectionName: string, message: string): void;
/**
* Update progress within the current phase/section
*/
updateProgress(state: Partial<ProgressState>): void;
/**
* Update resource metrics
*/
updateMetrics(metrics: Partial<ResourceMetrics>): void;
/**
* Complete the current phase
*/
completePhase(message: string): void;
/**
* Complete the current section
*/
completeSection(message: string): void;
/**
* Report an error in the current phase
*/
reportError(message: string, error?: Error): void;
/**
* Report a warning
*/
reportWarning(message: string): void;
/**
* Calculate overall progress based on phase weights and section completion
*/
private updateOverallProgress;
/**
* Check if a phase has been completed
*/
private isPhaseCompleted;
/**
* Calculate estimated time remaining
*/
private calculateETA;
/**
* Get current overall progress state
*/
getOverallState(): OverallProgressState;
/**
* Check if resource thresholds are exceeded
*/
checkThresholds(): {
exceeded: boolean;
warnings: string[];
};
/**
* Stop monitoring and return final metrics
*/
stopMonitoring(): ResourceMetrics;
/**
* Format duration in human-readable format
*/
private formatDuration;
/**
* Create a scoped progress callback for a specific section
*/
createSectionCallback(sectionName: string, sectionWeight?: number): ProgressCallback;
/**
* Create a progress callback that aggregates multiple sub-operations
*/
createAggregatedCallback(subOperations: Array<{
name: string;
weight: number;
}>): (operationName: string, progress: number) => void;
}
/**
* Factory function to create a progress orchestrator with sensible defaults
*/
export declare function createProgressOrchestrator(options: CLIOptions, context?: LogContext): ProgressOrchestrator;
//# sourceMappingURL=progress-orchestrator.d.ts.map