Skip to content

Commit

Permalink
Allow list of excluded tasks from benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert authored and evandowning committed Nov 22, 2024
1 parent 2095c0d commit b274867
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 48 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/all-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ on:
required: false
type: string
default: eu-north-1
snapshot_version:
description: 'Snapshot version (`new` or `latest`)'
required: false
type: string
default: 'latest'
include_tasks:
description: 'Comma-separated list of tasks to include'
required: false
type: string
default: ''
vpc_id:
description: 'AWS VPC id'
required: true
type: string
vpc_cidr:
description: 'AWS VPC CIDR'
required: true
type: string

env:
# nightly run default parameters
Expand Down Expand Up @@ -90,6 +108,10 @@ jobs:
aws_region: ${{ inputs.aws_region || 'ca-central-1' }}
# assumes the possible events are schedule or workflow_dispatch
ci_tag: ${{ github.event_name == 'schedule' && 'scheduled' || 'manual' }}
snapshot_version: ${{ inputs.snapshot_version }}
include_tasks: ${{ inputs.include_tasks }}
vpc_id: ${{ inputs.vpc_id }}
vpc_cidr: ${{ inputs.vpc_cidr }}
secrets:
SNAPSHOT_AWS_ACCESS_KEY_ID: ${{ secrets.SNAPSHOT_AWS_ACCESS_KEY_ID }}
SNAPSHOT_AWS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOT_AWS_SECRET_ACCESS_KEY }}
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/all-ingest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ on:
required: false
type: string
default: eu-north-1
vpc_id:
description: 'AWS VPC id'
required: true
type: string
vpc_cidr:
description: 'AWS VPC CIDR'
required: true
type: string

env:
WORKLOADS: ${{ inputs.workloads }}
Expand Down Expand Up @@ -96,6 +104,8 @@ jobs:
snapshot_version: ${{ inputs.snapshot_version }}
# assumes the only possible event is workflow_dispatch
ci_tag: 'manual'
vpc_id: ${{ inputs.vpc_id }}
vpc_cidr: ${{ inputs.vpc_cidr }}
secrets:
SNAPSHOT_AWS_ACCESS_KEY_ID: ${{ secrets.SNAPSHOT_AWS_ACCESS_KEY_ID }}
SNAPSHOT_AWS_SECRET_ACCESS_KEY: ${{ secrets.SNAPSHOT_AWS_SECRET_ACCESS_KEY }}
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ on:
required: false
type: string
default: 'latest'
include_tasks:
description: 'Comma-separated list of tasks to include'
required: false
type: string
default: ''
vpc_id:
description: 'AWS VPC id'
required: true
type: string
vpc_cidr:
description: 'AWS VPC CIDR'
required: true
type: string
secrets:
AWS_ACCESS_KEY_ID:
required: true
Expand Down Expand Up @@ -108,6 +121,8 @@ env:
TF_VAR_os_version: ${{ inputs.os_version }}
TF_VAR_distribution_version: ${{ inputs.os_version }}
TF_VAR_snapshot_version: ${{ inputs.snapshot_version }}
TF_VAR_vpc_id: ${{ inputs.vpc_id }}
TF_VAR_vpc_cidr: ${{ inputs.vpc_cidr }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SSH_OPTIONS: -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=10
Expand Down Expand Up @@ -324,11 +339,12 @@ jobs:
run: |
ssh -i $(terraform output -raw ssh_private_key_file) $SSH_OPTIONS \
-tt ubuntu@$(terraform output -raw load-generation-ip) -- \
"EXTRA_CLIENT_OPTIONS=timeout:240 RUN_GROUP_ID=$RUN_GROUP_ID CI_TAG=$CI_TAG bash -i /mnt/benchmark.sh $BENCHMARK_TYPE"
"set -x; bash -ixc \"EXTRA_CLIENT_OPTIONS=timeout:240 RUN_GROUP_ID=$RUN_GROUP_ID CI_TAG=$CI_TAG bash -x /mnt/benchmark.sh $BENCHMARK_TYPE;\""
env:
BENCHMARK_TYPE: ${{ inputs.benchmark_type }}
RUN_GROUP_ID: ${{ needs.prepare_workspace.outputs.now_run_group_id }}
CI_TAG: ${{ inputs.ci_tag }}
INCLUDE_TASKS: ${{ inputs.include_tasks }}

destroy_workspace:
needs: [prepare_workspace, run-osb, ingest-data]
Expand Down
4 changes: 0 additions & 4 deletions infra/get_latest_snapshot_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ def is_version_format(version: str) -> bool:
elif input_map["snapshot_version"] == "new":
latest_version = new_snapshot_version()
else:
subdirs = [x for x in subdirs if x == input_map["snapshot_version"]]
latest_version = input_map["snapshot_version"]
if len(subdirs) != 1:
print(f"Snapshot version {latest_version} not found", file=sys.stderr)
sys.exit(1)

output = {"latest_version": latest_version}
print(f"Latest version: {latest_version}", file=sys.stderr)
Expand Down
16 changes: 7 additions & 9 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,24 @@ resource "aws_key_pair" "ssh_key" {
public_key = tls_private_key.ssh_key.public_key_openssh
}

resource "aws_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
data "aws_vpc" "vpc" {
id = var.vpc_id
}

resource "aws_subnet" "subnet" {
cidr_block = cidrsubnet(aws_vpc.vpc.cidr_block, 3, 1)
vpc_id = aws_vpc.vpc.id
cidr_block = [var.vpc_cidr]
vpc_id = data.aws_vpc.vpc.id
availability_zone = var.aws_subnet_zone
}

resource "aws_internet_gateway" "gtw" {
vpc_id = aws_vpc.vpc.id
vpc_id = data.aws_vpc.vpc.id
}

resource "aws_security_group" "allow_osb" {
name = "${terraform.workspace}-allow-osb"
description = "Allow ES/OS/OSB inbound traffic and all outbound traffic"
vpc_id = aws_vpc.vpc.id
vpc_id = data.aws_vpc.vpc.id

lifecycle {
create_before_destroy = true
Expand Down Expand Up @@ -114,7 +112,7 @@ resource "aws_vpc_security_group_egress_rule" "allow_all_traffic_ipv4" {
}

resource "aws_route_table" "route-table-test-env" {
vpc_id = aws_vpc.vpc.id
vpc_id = data.aws_vpc.vpc.id
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.gtw.id
Expand Down
8 changes: 5 additions & 3 deletions infra/modules/elasticsearch/es-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ write_files:
permissions: '0644'
- path: /es_cluster.sh
encoding: gz+b64
content: ${es_cluster_script}
content: |
${es_cluster_script}
owner: root:root
permissions: '0755'
- path: /ssh_pub_key
content: ${authorized_ssh_key}
content: |
${authorized_ssh_key}
owner: ubuntu:ubuntu
permissions: '0644'

Expand All @@ -38,4 +40,4 @@ runcmd:
- [ sysctl, -p, /etc/sysctl.d/99-custom.conf ]
- [ chown, -R, ubuntu:ubuntu, /mnt ]
- [ mv, /ssh_pub_key, /home/ubuntu/.ssh/authorized_keys ]
- [ sudo, -u, ubuntu, /es_cluster.sh, ${es_password}, ${es_version}, ${es_arch}, ${es_snapshot_access_key}, ${es_snapshot_secret_key} ]
- [ sudo, -u, ubuntu, /es_cluster.sh, "${es_password}", "${es_version}", "${es_arch}", "${es_snapshot_access_key}", "${es_snapshot_secret_key}" ]
13 changes: 8 additions & 5 deletions infra/modules/elasticsearch/es-load-generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ write_files:
permissions: '0644'
- path: /load_generation.sh
encoding: gz+b64
content: ${load_script}
content: |
${load_script}
owner: root:root
permissions: '0755'
- path: /fix_files.sh
encoding: gz+b64
content: ${fix_files_script}
content: |
${fix_files_script}
owner: root:root
permissions: '0755'
- path: /es_indexes/big5/es_index_8.json
Expand Down Expand Up @@ -45,7 +47,8 @@ write_files:
permissions: '0644'
- path: /id_rsa
encoding: gz+b64
content: ${ssh_private_key}
content: |
${ssh_private_key}
owner: ubuntu:ubuntu
permissions: '0600'

Expand Down Expand Up @@ -78,8 +81,8 @@ runcmd:
- [ chown, -R, ubuntu:ubuntu, /mnt ]
- [ mv, /id_rsa, /home/ubuntu/.ssh/id_rsa ]
- [ chown, ubuntu:ubuntu, /home/ubuntu/.ssh/id_rsa ]
- [ sudo, -u, ubuntu, /load_generation.sh, ${es_cluster}, elastic, ${es_password}, ${distribution_version}, ${es_version}, "ES", ${instance_type}, ${cluster_instance_id}]
- [ sudo, -u, ubuntu, /fix_files.sh, https://${es_cluster}:9200, elastic, ${es_password} ]
- [ sudo, -u, ubuntu, /load_generation.sh, "${es_cluster}", elastic, "${es_password}", "${distribution_version}", "${es_version}", "ES", "${instance_type}", "${cluster_instance_id}"]
- [ sudo, -u, ubuntu, /fix_files.sh, "https://${es_cluster}:9200", elastic, "${es_password}" ]
- [sed, -i, '/^env.name =/c\env.name = ${benchmark_environment}', /mnt/.benchmark/benchmark.ini]
- [sed, -i, '/^datastore\./s/^/# /', /mnt/.benchmark/benchmark.ini]
- |
Expand Down
2 changes: 1 addition & 1 deletion infra/modules/elasticsearch/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ resource "aws_instance" "load-generation" {
workload = var.workload,
}
))),
ssh_private_key = base64gzip(var.ssh_priv_key)
ssh_private_key = yamlencode(base64gzip(var.ssh_priv_key))
}
)
user_data_replace_on_change = true
Expand Down
4 changes: 0 additions & 4 deletions infra/modules/elasticsearch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ variable "workload" {
variable "snapshot_version" {
description = "Specific version of the snapshot to restore"
type = string
validation {
condition = can(regex("^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}$", var.snapshot_version))
error_message = "Snapshot version must be: YYYY-mm-dd_HH-MM-ss"
}
}

variable "osb_version" {
Expand Down
4 changes: 2 additions & 2 deletions infra/modules/opensearch/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "aws_instance" "target-cluster" {
os_arch = local.cluster_arch,
os_snapshot_access_key = var.snapshot_user_aws_access_key_id,
os_snapshot_secret_key = var.snapshot_user_aws_secret_access_key,
authorized_ssh_key = var.ssh_pub_key,
authorized_ssh_key = yamlencode(base64gzip(var.ssh_pub_key)),
}
)
user_data_replace_on_change = true
Expand Down Expand Up @@ -84,7 +84,7 @@ resource "aws_instance" "load-generation" {
instance_type = var.cluster_instance_type
cluster_instance_id = aws_instance.target-cluster.id
fix_files_script = yamlencode(base64gzip(file("${path.module}/fix_files.sh")))
ssh_private_key = base64gzip(var.ssh_priv_key)
ssh_private_key = yamlencode(base64gzip(var.ssh_priv_key))
}
)
user_data_replace_on_change = true
Expand Down
9 changes: 6 additions & 3 deletions infra/modules/opensearch/os-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ write_files:
permissions: '0644'
- path: /os_cluster.sh
encoding: gz+b64
content: ${os_cluster_script}
content: |
${os_cluster_script}
owner: root:root
permissions: '0755'
- path: /ssh_pub_key
content: ${authorized_ssh_key}
encoding: gz+b64
content: |
${authorized_ssh_key}
owner: ubuntu:ubuntu
permissions: '0644'

Expand All @@ -38,4 +41,4 @@ runcmd:
- [ sysctl, -p, /etc/sysctl.d/99-custom.conf ]
- [ chown, -R, ubuntu:ubuntu, /mnt ]
- [ mv, /ssh_pub_key, /home/ubuntu/.ssh/authorized_keys ]
- [ sudo, -u, ubuntu, /os_cluster.sh, ${os_password}, ${os_version}, ${os_arch}, ${os_snapshot_access_key}, ${os_snapshot_secret_key} ]
- [ sudo, -u, ubuntu, /os_cluster.sh, "${os_password}", "${os_version}", "${os_arch}", "${os_snapshot_access_key}", "${os_snapshot_secret_key}" ]
5 changes: 3 additions & 2 deletions infra/modules/opensearch/os-load-generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ write_files:
permissions: '0644'
- path: /id_rsa
encoding: gz+b64
content: ${ssh_private_key}
content: |
${ssh_private_key}
owner: ubuntu:ubuntu
permissions: '0600'

Expand Down Expand Up @@ -66,7 +67,7 @@ runcmd:
- [ chown, -R, ubuntu:ubuntu, /mnt ]
- [ mv, /id_rsa, /home/ubuntu/.ssh/id_rsa ]
- [ chown, ubuntu:ubuntu, /home/ubuntu/.ssh/id_rsa ]
- [ sudo, -u, ubuntu, /load_generation.sh, ${os_cluster}, admin, ${os_password}, ${distribution_version}, ${os_version}, "OS", ${instance_type}, ${cluster_instance_id}]
- [ sudo, -u, ubuntu, /load_generation.sh, "${os_cluster}", "admin", "${os_password}", "${distribution_version}", "${os_version}", "OS", "${instance_type}", "${cluster_instance_id}"]
- [ sudo, -u, ubuntu, /fix_files.sh ]
- [sed, -i, '/^env.name =/c\env.name = ${benchmark_environment}', /mnt/.benchmark/benchmark.ini]
- [sed, -i, '/^datastore\./s/^/# /', /mnt/.benchmark/benchmark.ini]
Expand Down
4 changes: 0 additions & 4 deletions infra/modules/opensearch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ variable "workload" {
variable "snapshot_version" {
description = "Specific version of the snapshot to restore"
type = string
validation {
condition = can(regex("^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}$", var.snapshot_version))
error_message = "Snapshot version must be: YYYY-mm-dd_HH-MM-ss"
}
}

variable "osb_version" {
Expand Down
15 changes: 9 additions & 6 deletions infra/scripts/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

source /mnt/utils.sh

if [ $# -ne 1 ]; then
echo "Usage: bash benchmark.sh <run-type>"
if [ $# -lt 1 ]; then
echo "Usage: bash benchmark.sh <run-type> [include-tasks]"
echo " where <run-type> is 'official' or 'dev'"
exit 1
fi

RUN_TYPE=$1
INCLUDE_TASKS="$2"

if [ "$RUN_TYPE" != "official" ] && [ "$RUN_TYPE" != "dev" ]; then
echo "Error: <run-type> must be 'official' or 'dev'"
Expand Down Expand Up @@ -86,10 +87,12 @@ set -x
EXECUTION_DIR="/mnt/test_executions"
mkdir -p "$EXECUTION_DIR"

INCLUDE_TASKS="type:search,prod-queries"
if [ "$ENGINE_TYPE" == "OS" ]; then
# ElasticSearch doesn't support the warmup-indices operation
INCLUDE_TASKS+=",warmup-indices"
if [ -z "$INCLUDE_TASKS" ]; then
INCLUDE_TASKS="type:search,prod-queries"
if [ "$ENGINE_TYPE" == "OS" ]; then
# ElasticSearch doesn't support the warmup-indices operation
INCLUDE_TASKS+=",warmup-indices"
fi
fi

# Queries only
Expand Down
19 changes: 15 additions & 4 deletions infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,25 @@ variable "snapshot_version" {
description = "Version of the snapshot to deploy (latest, new, or a specific version)"
type = string
default = "latest"
validation {
condition = can(regex("^(latest|new)$", var.snapshot_version)) || can(regex("^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}$", var.snapshot_version))
error_message = "Snapshot version must be one of: latest, new, or a specific version (YYYY-mm-dd_HH-MM-ss)"
}
# TODO(Evan): Address this after finishing parallel tests
# validation {
# condition = can(regex("^(latest|new)$", var.snapshot_version)) || can(regex("^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}$", var.snapshot_version))
# error_message = "Snapshot version must be one of: latest, new, or a specific version (YYYY-mm-dd_HH-MM-ss)"
# }
}

variable "osb_version" {
description = "OpenSearch Benchmark version"
type = string
default = "1.11.0"
}

variable "vpc_id" {
description = "VPC id to use"
type = string
}

variable "vpc_cidr" {
description = "VPC subnet cidr to use"
type = string
}

0 comments on commit b274867

Please sign in to comment.