@@ -186,7 +186,7 @@ def create_dask_clients() -> List[Tuple[str, Optional[Client]]]:
186186 threaded_client = Client (threaded_cluster )
187187 clients .append (("threaded" , threaded_client ))
188188 except Exception as e :
189- print (f"Failed to create threaded client: { e } " )
189+ logging . info (f"Failed to create threaded client: { e } " )
190190
191191 # Process-based client (if not Windows or if requested)
192192 if platform .system () != "Windows" :
@@ -201,7 +201,7 @@ def create_dask_clients() -> List[Tuple[str, Optional[Client]]]:
201201 process_client = Client (process_cluster )
202202 clients .append (("processes" , process_client ))
203203 except Exception as e :
204- print (f"Failed to create process client: { e } " )
204+ logging . info (f"Failed to create process client: { e } " )
205205
206206 return clients
207207
@@ -314,7 +314,7 @@ def mock_tax_computation(self, data: pd.DataFrame, year: str) -> Dict:
314314 }
315315
316316 # Add some CPU time to simulate real computation
317- time . sleep ( 0.01 ) # 10ms per task
317+ _ = np . linalg . svd ( np . random . rand ( 50 , 50 ))
318318
319319 return result
320320
@@ -413,7 +413,7 @@ def test_small_dataset_multiprocessing(self, small_tax_data):
413413 )
414414 save_benchmark_result (result )
415415 assert result .success , f"Benchmark failed: { result .error_message } "
416- print (
416+ logging . info (
417417 f"Small dataset multiprocessing: { result .compute_time :.3f} s, { result .peak_memory_mb :.1f} MB peak"
418418 )
419419
@@ -425,7 +425,7 @@ def test_small_dataset_threaded(self, small_tax_data):
425425 )
426426 save_benchmark_result (result )
427427 assert result .success , f"Benchmark failed: { result .error_message } "
428- print (
428+ logging . info (
429429 f"Small dataset threaded: { result .compute_time :.3f} s, { result .peak_memory_mb :.1f} MB peak"
430430 )
431431
@@ -447,7 +447,7 @@ def test_medium_dataset_comparison(self, medium_tax_data):
447447 )
448448 results .append (result )
449449 save_benchmark_result (result )
450- print (
450+ logging . info (
451451 f"Medium { scheduler } : { result .compute_time :.3f} s, { result .peak_memory_mb :.1f} MB peak"
452452 )
453453
@@ -475,7 +475,7 @@ def test_distributed_clients_comparison(self, medium_tax_data):
475475 )
476476 results .append (result )
477477 save_benchmark_result (result )
478- print (
478+ logging . info (
479479 f"Distributed { client_name } : { result .compute_time :.3f} s, { result .peak_memory_mb :.1f} MB peak"
480480 )
481481
@@ -517,7 +517,7 @@ def test_memory_scaling(self, small_tax_data, medium_tax_data):
517517 if result .data_size_mb > 0
518518 else 0
519519 )
520- print (
520+ logging . info (
521521 f"Memory scaling { name } : { result .data_size_mb :.1f} MB data -> { result .peak_memory_mb :.1f} MB peak (ratio: { memory_per_mb :.2f} )"
522522 )
523523
@@ -551,7 +551,7 @@ def test_worker_scaling(self, medium_tax_data):
551551 )
552552 results .append (result )
553553 save_benchmark_result (result )
554- print (f"Worker scaling { num_workers } : { result .compute_time :.3f} s" )
554+ logging . info (f"Worker scaling { num_workers } : { result .compute_time :.3f} s" )
555555
556556 # Performance should improve or stay similar with more workers
557557 if all (r .success for r in results ):
@@ -560,7 +560,7 @@ def test_worker_scaling(self, medium_tax_data):
560560
561561 # Allow some overhead, but expect some improvement
562562 speedup = single_worker_time / max_worker_time
563- print (f"Speedup with { max_workers } workers: { speedup :.2f} x" )
563+ logging . info (f"Speedup with { max_workers } workers: { speedup :.2f} x" )
564564
565565 # Should be at least 1.2x speedup with multiple workers (conservative)
566566 if max_workers > 1 :
@@ -583,7 +583,7 @@ def test_large_dataset_stress(self, large_tax_data):
583583 )
584584 save_benchmark_result (result )
585585
586- print (
586+ logging . info (
587587 f"Large dataset stress ({ scheduler } ): { result .compute_time :.3f} s, { result .peak_memory_mb :.1f} MB peak"
588588 )
589589
@@ -613,7 +613,7 @@ def load_benchmark_results() -> List[BenchmarkResult]:
613613 result = BenchmarkResult (** data )
614614 results .append (result )
615615 except Exception as e :
616- print (f"Failed to load { filename } : { e } " )
616+ logging . info (f"Failed to load { filename } : { e } " )
617617
618618 return results
619619
@@ -622,12 +622,12 @@ def generate_benchmark_report():
622622 """Generate a summary report of all benchmark results."""
623623 results = load_benchmark_results ()
624624 if not results :
625- print ("No benchmark results found." )
625+ logging . info ("No benchmark results found." )
626626 return
627627
628- print ("\n " + "=" * 80 )
629- print ("DASK PERFORMANCE BENCHMARK REPORT" )
630- print ("=" * 80 )
628+ logging . info ("\n " + "=" * 80 )
629+ logging . info ("DASK PERFORMANCE BENCHMARK REPORT" )
630+ logging . info ("=" * 80 )
631631
632632 # Group by platform and scheduler
633633 by_config = {}
@@ -638,8 +638,8 @@ def generate_benchmark_report():
638638 by_config [key ].append (result )
639639
640640 for (platform , scheduler ), config_results in by_config .items ():
641- print (f"\n { platform } - { scheduler } :" )
642- print ("-" * 40 )
641+ logging . info (f"\n { platform } - { scheduler } :" )
642+ logging . info ("-" * 40 )
643643
644644 successful = [r for r in config_results if r .success ]
645645 failed = [r for r in config_results if not r .success ]
@@ -651,14 +651,14 @@ def generate_benchmark_report():
651651 avg_memory = sum (r .peak_memory_mb for r in successful ) / len (
652652 successful
653653 )
654- print (f" Successful tests: { len (successful )} " )
655- print (f" Average time: { avg_time :.3f} s" )
656- print (f" Average peak memory: { avg_memory :.1f} MB" )
654+ logging . info (f" Successful tests: { len (successful )} " )
655+ logging . info (f" Average time: { avg_time :.3f} s" )
656+ logging . info (f" Average peak memory: { avg_memory :.1f} MB" )
657657
658658 if failed :
659- print (f" Failed tests: { len (failed )} " )
659+ logging . info (f" Failed tests: { len (failed )} " )
660660 for failure in failed [:3 ]: # Show first 3 failures
661- print (f" { failure .test_name } : { failure .error_message } " )
661+ logging . info (f" { failure .test_name } : { failure .error_message } " )
662662
663663
664664if __name__ == "__main__" :
0 commit comments