33//! Provides commands for kernel management, discovery, and validation.
44
55use clap:: { Parser , Subcommand } ;
6- use rustkernels:: catalog:: { DomainInfo , domains, enabled_domains, total_kernel_count} ;
76use rustkernel_core:: {
8- config:: ProductionConfig ,
9- domain:: Domain ,
10- kernel:: KernelMode ,
11- registry:: KernelRegistry ,
12- resilience:: HealthCheckResult ,
13- runtime:: LifecycleState ,
14- traits:: HealthStatus ,
7+ config:: ProductionConfig , domain:: Domain , kernel:: KernelMode , registry:: KernelRegistry ,
8+ resilience:: HealthCheckResult , runtime:: LifecycleState , traits:: HealthStatus ,
159} ;
10+ use rustkernels:: catalog:: { DomainInfo , domains, enabled_domains, total_kernel_count} ;
1611use std:: path:: PathBuf ;
1712use tracing_subscriber:: { layer:: SubscriberExt , util:: SubscriberInitExt } ;
1813
@@ -1046,7 +1041,10 @@ fn cmd_runtime(action: RuntimeAction) -> anyhow::Result<()> {
10461041 println ! ( "Security Settings:" ) ;
10471042 println ! ( " RBAC Enabled: {}" , config. security. rbac_enabled) ;
10481043 println ! ( " Audit Logging: {}" , config. security. audit_logging) ;
1049- println ! ( " Multi-Tenancy: {}" , config. security. multi_tenancy_enabled) ;
1044+ println ! (
1045+ " Multi-Tenancy: {}" ,
1046+ config. security. multi_tenancy_enabled
1047+ ) ;
10501048 }
10511049
10521050 RuntimeAction :: Init { preset } => {
@@ -1101,7 +1099,7 @@ fn cmd_health(format: &str, component: Option<String>) -> anyhow::Result<()> {
11011099 HealthStatus :: Unknown => "unknown" ,
11021100 } ;
11031101 let comma = if i < filtered. len ( ) - 1 { "," } else { "" } ;
1104- println ! ( " \" {}\" : \" {}\" {}" , name, status, comma) ;
1102+ println ! ( " \" {}\" : \" {}\" {}" , name, status, comma) ;
11051103 }
11061104 println ! ( " }}" ) ;
11071105 println ! ( "}}" ) ;
@@ -1113,15 +1111,33 @@ fn cmd_health(format: &str, component: Option<String>) -> anyhow::Result<()> {
11131111 for ( name, result) in & filtered {
11141112 let ( icon, status, details) = match result. status {
11151113 HealthStatus :: Healthy => ( "✓" , "Healthy" , String :: new ( ) ) ,
1116- HealthStatus :: Degraded => ( "⚠" , "Degraded" , result. error . clone ( ) . map ( |e| format ! ( " - {}" , e) ) . unwrap_or_default ( ) ) ,
1117- HealthStatus :: Unhealthy => ( "✗" , "Unhealthy" , result. error . clone ( ) . map ( |e| format ! ( " - {}" , e) ) . unwrap_or_default ( ) ) ,
1114+ HealthStatus :: Degraded => (
1115+ "⚠" ,
1116+ "Degraded" ,
1117+ result
1118+ . error
1119+ . clone ( )
1120+ . map ( |e| format ! ( " - {}" , e) )
1121+ . unwrap_or_default ( ) ,
1122+ ) ,
1123+ HealthStatus :: Unhealthy => (
1124+ "✗" ,
1125+ "Unhealthy" ,
1126+ result
1127+ . error
1128+ . clone ( )
1129+ . map ( |e| format ! ( " - {}" , e) )
1130+ . unwrap_or_default ( ) ,
1131+ ) ,
11181132 HealthStatus :: Unknown => ( "?" , "Unknown" , String :: new ( ) ) ,
11191133 } ;
11201134 println ! ( " {} {:<15} {}{}" , icon, name, status, details) ;
11211135 }
11221136
11231137 println ! ( ) ;
1124- let all_healthy = filtered. iter ( ) . all ( |( _, r) | r. status == HealthStatus :: Healthy ) ;
1138+ let all_healthy = filtered
1139+ . iter ( )
1140+ . all ( |( _, r) | r. status == HealthStatus :: Healthy ) ;
11251141 if all_healthy {
11261142 println ! ( "Overall: ✓ All systems healthy" ) ;
11271143 } else {
@@ -1158,8 +1174,14 @@ fn cmd_config(action: ConfigAction) -> anyhow::Result<()> {
11581174 println ! ( " Max Instances: {}" , config. runtime. max_kernel_instances) ;
11591175 println ! ( ) ;
11601176 println ! ( "Memory:" ) ;
1161- println ! ( " Max GPU Memory: {} bytes" , config. memory. max_gpu_memory) ;
1162- println ! ( " Max Staging Memory: {} bytes" , config. memory. max_staging_memory) ;
1177+ println ! (
1178+ " Max GPU Memory: {} bytes" ,
1179+ config. memory. max_gpu_memory
1180+ ) ;
1181+ println ! (
1182+ " Max Staging Memory: {} bytes" ,
1183+ config. memory. max_staging_memory
1184+ ) ;
11631185 }
11641186
11651187 ConfigAction :: Validate { file } => {
@@ -1230,7 +1252,9 @@ fn cmd_config(action: ConfigAction) -> anyhow::Result<()> {
12301252 println ! ( " RUSTKERNEL_MAX_GPU_MEMORY_GB Maximum GPU memory in GB" ) ;
12311253 println ! ( ) ;
12321254 println ! ( "Example:" ) ;
1233- println ! ( " RUSTKERNEL_ENV=production RUSTKERNEL_GPU_ENABLED=true rustkernel runtime init" ) ;
1255+ println ! (
1256+ " RUSTKERNEL_ENV=production RUSTKERNEL_GPU_ENABLED=true rustkernel runtime init"
1257+ ) ;
12341258 }
12351259 }
12361260
0 commit comments