コード例 #1
0
def test_read_bazel_options():

  control_json = """
  {
    "remote": false,
    "dockerizedBenchmark": true,
    "source": [
      {
        "identity": "SRCID_ENVOY",
        "sourcePath": "/home/ubuntu/envoy",
        "branch": "some_random_branch",
        "commitHash": "random_commit_hash_string",
        "bazelOptions": [
          {
            "parameter": "--jobs 4"
          },
          {
            "parameter": "--define tcmalloc=gperftools"
          }
        ]
      }
    ]
  }
  """
  # Write JSON contents to a temporary file that we clean up once
  # the object is parsed
  job_control = None
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp:
    tmp.write(control_json)
    tmp.close()
    job_control = job_ctrl.load_control_doc(tmp.name)
    os.unlink(tmp.name)

  _validate_job_control_object_with_options(job_control)
コード例 #2
0
ファイル: salvo.py プロジェクト: landesherr/envoy-perf
def main() -> int:
    """Driver module for benchmark.

  This is the main function for starting a benchmark.  It verifies that a
  Job Control object was specified and from that starts the execution.

  The benchmark object encapsulates the different benchmark modes and it
  is responsible for selecting the correct classes to instantiate
  """

    args = setup_options()
    setup_logging()

    if not args.jobcontrol:
        print("No job control document specified.  Use \"--help\" for usage")
        return 1

    job_control = load_control_doc(args.jobcontrol)
    if job_control is None:
        log.error(f"Unable to load or parse job control: {args.jobcontrol}")
        return 1

    bar = '=' * 20
    log.debug(f"Job definition:\n{bar}\n{job_control}\n{bar}\n")

    # Execute the benchmark given the contents of the job control file
    benchmark = run_benchmark.BenchmarkRunner(job_control)
    benchmark.execute()

    return 0
コード例 #3
0
def test_control_doc_parse():
  """Verify that we can consume a JSON formatted control document.

  This method reads a JSON representation of the job control document,
  serializes it, then verifies that the serialized data matches the
  input.
  """

  control_json = """
    {
      "remote": true,
      "scavengingBenchmark": true,
      "source": [
        {
          "identity": SRCID_NIGHTHAWK,
          "source_url": "https://github.com/envoyproxy/nighthawk.git",
          "branch": "master"
        },
        {
          "identity": SRCID_ENVOY,
          "source_path": "/home/ubuntu/envoy",
          "branch": "master",
          "commit_hash": "random_commit_hash_string"
        }
      ],
      "images": {
        "reuseNhImages": true,
        "nighthawkBenchmarkImage": "envoyproxy/nighthawk-benchmark-dev:latest",
        "nighthawkBinaryImage": "envoyproxy/nighthawk-dev:latest",
        "envoyImage": "envoyproxy/envoy-dev:f61b096f6a2dd3a9c74b9a9369a6ea398dbe1f0f"
      },
      "environment": {
        testVersion: IPV_V4ONLY,
        "envoyPath": "envoy",
        "outputDir": "/home/ubuntu/nighthawk_output",
        "testDir": "/home/ubuntu/nighthawk_tests",
        "variables": {
          "TMP_DIR": "/home/ubuntu/nighthawk_output"
        }
      }
    }
    """

  # Write JSON contents to a temporary file that we clean up once
  # the object is parsed
  job_control = None
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp:
    tmp.write(control_json)
    tmp.close()
    job_control = job_ctrl.load_control_doc(tmp.name)
    os.unlink(tmp.name)

  _validate_job_control_object(job_control)
コード例 #4
0
ファイル: salvo.py プロジェクト: isabella232/envoy-perf
def main():
    """Driver module for benchmark """

    args = setup_options()
    setup_logging()

    if not args.jobcontrol:
        print("No job control document specified.  Use \"--help\" for usage")
        return 1

    job_control = load_control_doc(args.jobcontrol)

    log.debug("Job definition:\n%s\n%s\n%s\n", '=' * 20, job_control, '=' * 20)

    # Execute the benchmark given the contents of the job control file

    return 0
コード例 #5
0
def test_control_doc_parse_yaml():
  """Verify that we can consume a yaml formatted control document.

  This method reads a yaml representation of the job control document,
  serializes it, then verifies that the serialized data matches the
  input.
  """
  control_yaml = """
      remote: true
      scavengingBenchmark: true
      source:
        - identity: SRCID_NIGHTHAWK
          source_url: "https://github.com/envoyproxy/nighthawk.git"
          branch: "master"
        - identity: SRCID_ENVOY
          source_path: "/home/ubuntu/envoy"
          branch: "master"
          commit_hash: "random_commit_hash_string"
      images:
        reuseNhImages: true
        nighthawkBenchmarkImage: "envoyproxy/nighthawk-benchmark-dev:latest"
        nighthawkBinaryImage: "envoyproxy/nighthawk-dev:latest"
        envoyImage: "envoyproxy/envoy-dev:f61b096f6a2dd3a9c74b9a9369a6ea398dbe1f0f"
      environment:
        testVersion: IPV_V4ONLY
        envoyPath: "envoy"
        outputDir: "/home/ubuntu/nighthawk_output"
        testDir: "/home/ubuntu/nighthawk_tests"
        variables:
          TMP_DIR: "/home/ubuntu/nighthawk_output"
    """

  # Write YAML contents to a temporary file that we clean up once
  # the object is parsed
  job_control = None
  with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmp:
    tmp.write(control_yaml)
    tmp.close()
    job_control = job_ctrl.load_control_doc(tmp.name)
    os.unlink(tmp.name)

  _validate_job_control_object(job_control)
コード例 #6
0
def main() -> int:
  """Driver module for benchmark.

  This is the main function for starting a benchmark.  It verifies that a
  Job Control object was specified and from that starts the execution.

  The benchmark object encapsulates the different benchmark modes and it
  is responsible for selecting the correct classes to instantiate
  """

  args = setup_options()
  setup_logging()

  if not args.jobcontrol:
    print("No job control document specified.  Use \"--help\" for usage")
    return 1

  job_control = load_control_doc(args.jobcontrol)

  log.debug("Job definition:\n%s\n%s\n%s\n", '=' * 20, job_control, '=' * 20)

  # Execute the benchmark given the contents of the job control file

  return 0