class_docstr: Actor which tests will report metrics to.
code: def create_results_dict_from_measurements(
      all_measurements, expected_measurements_per_test
  ):
      results = {}
      perf_metrics = []
  
      for test_name, measurements in all_measurements.items():
          test_summary = {
              "measurements": measurements,
          }
  
          if len(measurements) == expected_measurements_per_test:
              median = statistics.median(measurements)
              test_summary["p50"] = median
              perf_metrics.append(
                  {
                      "perf_metric_name": f"p50.{test_name}",
                      "perf_metric_value": median,
                      "perf_metric_type": "LATENCY",
                  }
              )
  
          results[test_name] = test_summary
  
      results["perf_metrics"] = perf_metrics
      return results
  
imports: from collections import defaultdict
  from dataclasses import dataclass
  from ray._private.test_utils import safe_write_to_results_json
  from ray.job_submission import JobSubmissionClient, JobStatus
  import argparse
  import asyncio
  import random
  import ray
  import statistics
  import subprocess
  import sys
label_desc: Use image node_id 3 for calling the MetricsActor obj's underlying member method code with example usage: obj.create_results_dict_from_measurements(all_measurements, expected_measurements_per_test) and returns: results