Skip to content

Commit 6b9abc7

Browse files
[Test] Push performance data to DynamoDB table
1. Create a separate table called ParallelCluster-PerformanceTest-Metadata if not exist 2. Push OpenFoam, OSU, StarCCM performance result to the table
1 parent 76fdf43 commit 6b9abc7

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

tests/integration-tests/framework/framework_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
# limitations under the License.
88

99
METADATA_TABLE = "ParallelCluster-IntegTest-Metadata"
10+
PERFORMANCE_METADATA_TABLE = "ParallelCluster-PerformanceTest-Metadata"
1011
METADATA_DEFAULT_REGION = "us-east-1"

tests/integration-tests/tests/performance_tests/common.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
import os as os_lib
44
import pathlib
55
import shutil
6+
import time
7+
import uuid
68
from math import ceil
79
from os import makedirs
810

911
import boto3
1012
from assertpy import assert_that
13+
from framework.framework_constants import METADATA_DEFAULT_REGION, PERFORMANCE_METADATA_TABLE
14+
from framework.metadata_table_manager import MetadataTableManager
1115
from retrying import retry
1216
from time_utils import seconds
1317
from utils import get_username_for_os
1418

15-
from tests.common.utils import fetch_instance_slots
19+
from tests.common.utils import fetch_instance_slots, get_installed_parallelcluster_version
1620

1721
# Common settings used by all test scenarios
1822
# You can change these variables to adapt the performance test to your needs.
@@ -249,3 +253,33 @@ def _log_output_performance_difference(node, performance_degradation, observed_v
249253
f"Nodes: {node}, Baseline: {baseline_value} seconds, Observed: {observed_value} seconds, "
250254
f"Percentage difference: {percentage_difference}%, Outcome: {outcome}"
251255
)
256+
257+
258+
def push_result_to_dynamodb(name, result, instance, os):
259+
reporting_region = METADATA_DEFAULT_REGION
260+
logging.info(f"Metadata reporting region {reporting_region}")
261+
# Create the metadata table in case it doesn't exist
262+
MetadataTableManager(reporting_region, PERFORMANCE_METADATA_TABLE).create_metadata_table()
263+
try:
264+
# Create DynamoDB resource
265+
dynamodb = boto3.resource("dynamodb", region_name=reporting_region)
266+
table = dynamodb.Table(PERFORMANCE_METADATA_TABLE)
267+
268+
# Prepare item to be inserted
269+
item = {
270+
"id": str(uuid.uuid4().hex),
271+
"name": name,
272+
"instance": instance,
273+
"os": os,
274+
"timestamp": int(time.time()),
275+
"result": str(result),
276+
"pcluster_version": f"v{get_installed_parallelcluster_version()}",
277+
}
278+
279+
# Put item in the table
280+
table.put_item(Item=item)
281+
logging.info(f"Successfully pushed result to DynamoDB with id: {item['id']}")
282+
283+
except Exception as e:
284+
logging.error(f"Failed to push result to DynamoDB: {str(e)}")
285+
raise

tests/integration-tests/tests/performance_tests/test_openfoam.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
from remote_command_executor import RemoteCommandExecutionError, RemoteCommandExecutor
66

7-
from tests.performance_tests.common import _log_output_performance_difference
7+
from tests.performance_tests.common import _log_output_performance_difference, push_result_to_dynamodb
88

99
# timeout in seconds
1010
OPENFOAM_INSTALLATION_TIMEOUT = 300
@@ -91,8 +91,10 @@ def test_openfoam(
9191
observed_value_8 = future_8.result()
9292
observed_value_16 = future_16.result()
9393

94+
result = list(zip(number_of_nodes, [observed_value_8, observed_value_16, observed_value_32]))
95+
push_result_to_dynamodb("OpenFOAM", result, instance, os)
9496
# Check results and log performance degradation
95-
for node, observed_value in zip(number_of_nodes, [observed_value_8, observed_value_16, observed_value_32]):
97+
for node, observed_value in result:
9698
baseline_value = BASELINE_CLUSTER_SIZE_ELAPSED_SECONDS[os][node]
9799
_log_output_performance_difference(node, performance_degradation, observed_value, baseline_value)
98100

tests/integration-tests/tests/performance_tests/test_osu.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
run_system_analyzer,
2626
write_file,
2727
)
28+
from tests.performance_tests.common import push_result_to_dynamodb
2829

2930
# We collected OSU benchmarks results for c5n.18xlarge only.
3031
OSU_BENCHMARKS_INSTANCES = ["c5n.18xlarge"]
@@ -237,7 +238,9 @@ def _check_osu_benchmarks_results(test_datadir, output_dir, os, instance, mpi_ve
237238
metric_data = []
238239
metric_namespace = "ParallelCluster/test_efa"
239240
evaluation_output = ""
240-
for packet_size, value in re.findall(r"(\d+)\s+(\d+)\.", output):
241+
result = re.findall(r"(\d+)\s+(\d+)\.", output)
242+
push_result_to_dynamodb(f"OSU_{benchmark_name}", result, instance, os)
243+
for packet_size, value in result:
241244
with open(
242245
str(test_datadir / "osu_benchmarks" / "results" / os / instance / mpi_version / benchmark_name),
243246
encoding="utf-8",

tests/integration-tests/tests/performance_tests/test_starccm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from remote_command_executor import RemoteCommandExecutionError, RemoteCommandExecutor
77

88
from tests.common.utils import assert_no_file_handler_leak, get_compute_ip_to_num_files
9-
from tests.performance_tests.common import _log_output_performance_difference
9+
from tests.performance_tests.common import _log_output_performance_difference, push_result_to_dynamodb
1010

1111
# timeout in seconds
1212
STARCCM_INSTALLATION_TIMEOUT = 1800
@@ -125,7 +125,9 @@ def test_starccm(
125125
)
126126

127127
# Check results and log performance degradation
128-
for node, observed_value in zip(number_of_nodes, [observed_value_8, observed_value_16, observed_value_32]):
128+
result = list(zip(number_of_nodes, [observed_value_8, observed_value_16, observed_value_32]))
129+
push_result_to_dynamodb("StarCCM", result, instance, os)
130+
for node, observed_value in result:
129131
baseline_value = BASELINE_CLUSTER_SIZE_ELAPSED_SECONDS[os][node]
130132
_log_output_performance_difference(node, performance_degradation, observed_value, baseline_value)
131133

0 commit comments

Comments
 (0)