@@ -782,3 +782,143 @@ def test_scheduler_performance_fields_without_vm(tmp_path):
782782 assert m ["requestedVmCpuEfficiency" ] is None
783783 assert m ["realVmCpuEfficiency" ] is None
784784 assert m ["vmPackingSlackCpuH" ] is None
785+
786+
787+ def test_pr132_style_scheduler_vm_semantics (tmp_path ):
788+ jsonl_dir = tmp_path / "jsonl_bundle"
789+ jsonl_dir .mkdir (parents = True )
790+
791+ runs = [
792+ {
793+ "run_id" : "batch-run" ,
794+ "group" : "Batch-OnD" ,
795+ "pipeline" : "nf-core/rnaseq" ,
796+ "username" : "u" ,
797+ "pipeline_version" : "main" ,
798+ "nextflow_version" : "24.10.0" ,
799+ "platform_version" : "x" ,
800+ "succeeded" : 1 ,
801+ "failed" : 0 ,
802+ "cached" : 0 ,
803+ "status" : "SUCCEEDED" ,
804+ "executor" : "awsbatch" ,
805+ "region" : "eu-west-1" ,
806+ "fusion_enabled" : True ,
807+ "wave_enabled" : True ,
808+ "container_engine" : "docker" ,
809+ "duration_ms" : 10 ,
810+ "cpu_time_ms" : 1000 ,
811+ "cpu_efficiency" : 50.0 ,
812+ "memory_efficiency" : 50.0 ,
813+ "read_bytes" : 0 ,
814+ "write_bytes" : 0 ,
815+ },
816+ {
817+ "run_id" : "sched-run" ,
818+ "group" : "Sched-SpotFirst-Predv1" ,
819+ "pipeline" : "nf-core/rnaseq" ,
820+ "username" : "u" ,
821+ "pipeline_version" : "main" ,
822+ "nextflow_version" : "26.03.0-edge" ,
823+ "platform_version" : "x" ,
824+ "succeeded" : 1 ,
825+ "failed" : 0 ,
826+ "cached" : 0 ,
827+ "status" : "SUCCEEDED" ,
828+ "executor" : "awsbatch" ,
829+ "region" : "eu-west-1" ,
830+ "fusion_enabled" : True ,
831+ "wave_enabled" : True ,
832+ "container_engine" : "docker" ,
833+ "duration_ms" : 10 ,
834+ "cpu_time_ms" : 1000 ,
835+ "cpu_efficiency" : 50.0 ,
836+ "memory_efficiency" : 50.0 ,
837+ "read_bytes" : 0 ,
838+ "write_bytes" : 0 ,
839+ },
840+ ]
841+ tasks = [
842+ {
843+ "run_id" : "batch-run" ,
844+ "group" : "Batch-OnD" ,
845+ "hash" : "ab/cdef12" ,
846+ "process" : "NFCORE_RNASEQ:FASTQC" ,
847+ "process_short" : "FASTQC" ,
848+ "name" : "FASTQC" ,
849+ "status" : "COMPLETED" ,
850+ "staging_ms" : 0 ,
851+ "realtime_ms" : 3_600_000 ,
852+ "duration_ms" : 3_600_000 ,
853+ "cost" : 1.0 ,
854+ "cpus" : 4 ,
855+ "memory_bytes" : 16 * 1024 ** 3 ,
856+ "pcpu" : 300.0 ,
857+ "peak_rss" : 8 * 1024 ** 3 ,
858+ "machine_type" : "c6id.8xlarge" ,
859+ "cloud_zone" : "eu-west-1a" ,
860+ "executor" : "awsbatch" ,
861+ },
862+ {
863+ "run_id" : "sched-run" ,
864+ "group" : "Sched-SpotFirst-Predv1" ,
865+ "hash" : "ab/cdef34" ,
866+ "process" : "NFCORE_RNASEQ:FASTQC" ,
867+ "process_short" : "FASTQC" ,
868+ "name" : "FASTQC" ,
869+ "status" : "COMPLETED" ,
870+ "staging_ms" : 0 ,
871+ "realtime_ms" : 3_600_000 ,
872+ "duration_ms" : 3_600_000 ,
873+ "cost" : 1.0 ,
874+ "cpus" : 4 ,
875+ "memory_bytes" : 16 * 1024 ** 3 ,
876+ "pcpu" : 200.0 ,
877+ "peak_rss" : 8 * 1024 ** 3 ,
878+ "machine_type" : "m7i.4xlarge" ,
879+ "cloud_zone" : "eu-west-1b" ,
880+ "executor" : "awsbatch" ,
881+ },
882+ ]
883+ machines = [
884+ {
885+ "run_id" : "batch-run" ,
886+ "n_machines" : 2 ,
887+ "vm_cpu_h" : 4.0 ,
888+ "vm_mem_gib_h" : 16.0 ,
889+ "sched_alloc_cpu_efficiency" : 100.0 ,
890+ "sched_alloc_mem_efficiency" : 100.0 ,
891+ },
892+ {
893+ "run_id" : "sched-run" ,
894+ "n_machines" : 1 ,
895+ "vm_cpu_h" : 6.0 ,
896+ "vm_mem_gib_h" : 24.0 ,
897+ "sched_alloc_cpu_efficiency" : 50.0 ,
898+ "sched_alloc_mem_efficiency" : 50.0 ,
899+ },
900+ ]
901+
902+ (jsonl_dir / "runs.jsonl" ).write_text ("" .join (json .dumps (r ) + "\n " for r in runs ))
903+ (jsonl_dir / "tasks.jsonl" ).write_text ("" .join (json .dumps (t ) + "\n " for t in tasks ))
904+ (jsonl_dir / "machines.jsonl" ).write_text ("" .join (json .dumps (m ) + "\n " for m in machines ))
905+
906+ data = build_report_data (jsonl_dir )
907+ metrics = {row ["group" ]: row for row in data ["run_metrics" ]}
908+
909+ batch = metrics ["Batch-OnD" ]
910+ sched = metrics ["Sched-SpotFirst-Predv1" ]
911+
912+ assert batch ["nMachines" ] == 2
913+ assert batch ["schedulerBookedCpuH" ] == 4.0
914+ assert batch ["schedulerRightsizedCpuH" ] == 0.0
915+ assert batch ["schedulerOverbookCpuH" ] == 1.0
916+ assert batch ["vmPackingSlackCpuH" ] == 0.0
917+ assert batch ["realVmCpuEfficiency" ] == 75.0
918+
919+ assert sched ["nMachines" ] == 1
920+ assert sched ["schedulerBookedCpuH" ] == 3.0
921+ assert sched ["schedulerRightsizedCpuH" ] == 1.0
922+ assert sched ["schedulerOverbookCpuH" ] == 1.0
923+ assert sched ["vmPackingSlackCpuH" ] == 3.0
924+ assert sched ["realVmCpuEfficiency" ] == 33.33
0 commit comments