@@ -60,111 +60,6 @@ struct ResourceUtilizationRow {
6060 over_utilization : String ,
6161}
6262
63- #[ derive( clap:: Subcommand ) ]
64- #[ command( after_long_help = "\
65- EXAMPLES:
66- # Get workflow summary
67- torc reports summary 123
68-
69- # Get comprehensive results report
70- torc -f json reports results 123 > report.json
71-
72- # Check resource utilization
73- torc reports check-resource-utilization 123
74- " ) ]
75- pub enum ReportCommands {
76- /// Check resource utilization and report jobs that exceeded their specified requirements
77- #[ command( after_long_help = "\
78- EXAMPLES:
79- torc reports check-resource-utilization 123
80- torc reports check-resource-utilization 123 --all
81- torc reports check-resource-utilization 123 --include-failed
82- " ) ]
83- CheckResourceUtilization {
84- /// Workflow ID to analyze (optional - will prompt if not provided)
85- #[ arg( ) ]
86- workflow_id : Option < i64 > ,
87- /// Run ID to analyze (optional - analyzes latest run if not provided)
88- #[ arg( short, long) ]
89- run_id : Option < i64 > ,
90- /// Show all jobs (default: only show jobs that exceeded requirements)
91- #[ arg( short, long) ]
92- all : bool ,
93- /// Include failed and terminated jobs in the analysis (for recovery diagnostics)
94- #[ arg( long) ]
95- include_failed : bool ,
96- /// Minimum over-utilization percentage to flag as violation (default: 1.0%)
97- #[ arg( long, default_value = "1.0" ) ]
98- min_over_utilization : f64 ,
99- } ,
100- /// Generate a comprehensive JSON report of job results including all log file paths
101- #[ command( after_long_help = "\
102- EXAMPLES:
103- torc reports results 123
104- torc -f json reports results 123 > results.json
105- torc reports results 123 --all-runs
106- torc reports results 123 --job-id 45 --job-id 46
107- " ) ]
108- Results {
109- /// Workflow ID to analyze (optional - will prompt if not provided)
110- #[ arg( ) ]
111- workflow_id : Option < i64 > ,
112- /// Output directory (where job logs are stored, passed in `torc run` and `torc submit`)
113- #[ arg( short, long, default_value = "torc_output" ) ]
114- output_dir : std:: path:: PathBuf ,
115- /// Include all runs for each job (default: only latest run)
116- #[ arg( long) ]
117- all_runs : bool ,
118- /// Filter results to only include these job IDs (can be specified multiple times)
119- #[ arg( long = "job-id" , short = 'j' ) ]
120- job_ids : Vec < i64 > ,
121- } ,
122- /// Generate a summary of workflow results (requires workflow to be complete)
123- #[ command( after_long_help = "\
124- EXAMPLES:
125- torc reports summary 123
126- torc -f json reports summary 123
127- " ) ]
128- Summary {
129- /// Workflow ID to summarize (optional - will prompt if not provided)
130- #[ arg( ) ]
131- workflow_id : Option < i64 > ,
132- } ,
133- }
134-
135- pub fn handle_report_commands ( config : & Configuration , command : & ReportCommands , format : & str ) {
136- match command {
137- ReportCommands :: CheckResourceUtilization {
138- workflow_id,
139- run_id,
140- all,
141- include_failed,
142- min_over_utilization,
143- } => {
144- check_resource_utilization (
145- config,
146- * workflow_id,
147- * run_id,
148- * all,
149- * include_failed,
150- * min_over_utilization,
151- format,
152- ) ;
153- }
154- ReportCommands :: Results {
155- workflow_id,
156- output_dir,
157- all_runs,
158- job_ids,
159- } => {
160- generate_results_report ( config, * workflow_id, output_dir, * all_runs, job_ids) ;
161- }
162- ReportCommands :: Summary { workflow_id } => {
163- generate_summary ( config, * workflow_id, format) ;
164- }
165- }
166- }
167-
16863pub fn check_resource_utilization (
16964 config : & Configuration ,
17065 workflow_id : Option < i64 > ,
0 commit comments