| 338 | /// Configure the executor with new settings |
| 339 | #[pyo3(signature = (timeout_seconds=None, max_retries=None, enable_metrics=None, debug=None))] |
| 340 | fn configure( |
| 341 | &mut self, |
| 342 | timeout_seconds: Option<u64>, |
| 343 | max_retries: Option<u32>, |
| 344 | enable_metrics: Option<bool>, |
| 345 | debug: Option<bool>, |
| 346 | ) -> PyResult<()> { |
| 347 | // Validate timeout |
| 348 | if let Some(timeout) = timeout_seconds { |
| 349 | if timeout == 0 || timeout > 3600 { |
| 350 | return Err(validation_error( |
| 351 | "timeout_seconds", |
| 352 | Some(&timeout.to_string()), |
| 353 | "Timeout must be between 1 and 3600 seconds", |
| 354 | )); |
| 355 | } |
| 356 | self.config.timeout = Duration::from_secs(timeout); |
| 357 | } |
| 358 | |
| 359 | // Validate retries |
| 360 | if let Some(retries) = max_retries { |
| 361 | if retries == 0 || retries > 10 { |
| 362 | return Err(validation_error( |
| 363 | "max_retries", |
| 364 | Some(&retries.to_string()), |
| 365 | "Maximum retries must be between 1 and 10", |
| 366 | )); |
| 367 | } |
| 368 | self.config.max_retries = retries; |
| 369 | } |
| 370 | |
| 371 | if let Some(metrics) = enable_metrics { |
| 372 | self.config.enable_metrics = metrics; |
| 373 | } |
| 374 | |
| 375 | if let Some(debug_mode) = debug { |
| 376 | self.config.enable_tracing = debug_mode; |
| 377 | } |
| 378 | |
| 379 | if self.config.enable_tracing { |
| 380 | info!( |
| 381 | "Executor configuration updated: timeout={:?}, retries={}, metrics={}, debug={}", |
| 382 | self.config.timeout, |
| 383 | self.config.max_retries, |
| 384 | self.config.enable_metrics, |
| 385 | self.config.enable_tracing |
| 386 | ); |
| 387 | } |
| 388 | |
| 389 | Ok(()) |
| 390 | } |
| 391 | |
| 392 | /// Get comprehensive execution statistics |
| 393 | fn get_stats<'a>(&self, py: Python<'a>) -> PyResult<Bound<'a, PyDict>> { |