Skip to content

Commit 7c87b8c

Browse files
committed
enh: change method to cal insert perf
1 parent f3be905 commit 7c87b8c

File tree

5 files changed

+38
-17
lines changed

5 files changed

+38
-17
lines changed

.github/workflows/ems-test.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,11 @@ jobs:
425425
group: customers
426426
labels: ${{ matrix.runner }}
427427
steps:
428-
- name: Export Client IP
428+
- name: Export Client Host
429429
run: |
430-
ip=$(hostname -I | awk '{print $1}')
431-
echo "CLIENT_IP=$ip" >> $GITHUB_ENV
430+
# ip=$(hostname -I | awk '{print $1}')
431+
# echo "CLIENT_IP=$ip" >> $GITHUB_ENV
432+
echo "CLIENT_HOST=$HOSTNAME" >> $GITHUB_ENV
432433
433434
# - name: Sync Repo - taos-test-framework
434435
# uses: taosdata/.github/.github/actions/sync-repo@main
@@ -512,8 +513,8 @@ jobs:
512513
- name: Import Process Exporter Dashboard
513514
uses: taosdata/.github/.github/actions/import-process-exporter-dashboard@main
514515
with:
515-
grafana-url: http://${{ env.CLIENT_IP }}:3000
516-
prometheus-url: http://${{ env.CLIENT_IP }}:9090
516+
grafana-url: http://${{ env.CLIENT_HOST }}:3000
517+
prometheus-url: http://${{ env.CLIENT_HOST }}:9090
517518
datasource-name: ${{ env.PROCESS_EXPORTER_DATASOURCE_NAME }}
518519

519520
- name: Install Grafana Plugin
@@ -525,7 +526,7 @@ jobs:
525526
- name: Import Grafana Dashboard
526527
uses: taosdata/.github/.github/actions/import-grafana-dashboard@main
527528
with:
528-
grafana-url: http://${{ env.CLIENT_IP }}:3000
529+
grafana-url: http://${{ env.CLIENT_HOST }}:3000
529530
dashboard-ids: ${{ env.TDINSIGHT_DASHBOARD_IDS }}
530531
dashboard-uids: ${{ env.TDINSIGHT_DASHBOARD_UIDS }}
531532

@@ -553,7 +554,7 @@ jobs:
553554
EDGE_DNODE_HOSTS=$SINGLE_DNODE_HOSTS
554555
TAOS_BENCHMARK_HOSTS=$TAOS_BENCHMARK_HOSTS
555556
CENTER_DNODE_HOSTS=$CLUSTER_HOSTS
556-
GRAFANA_IP="${{ env.CLIENT_IP }}"
557+
GRAFANA_IP="${{ env.CLIENT_HOST }}"
557558
GRAFANA_DATASOURCE_NAME=$(echo "${{ env.TDINSIGHT_DASHBOARD_UIDS }}" | cut -d ',' -f 1)
558559
559560
# Combine Inputs into a single JSON object

tests/cases/customer_scenarios/ems/ems_edge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from taostest.util.rest import TDRest
66
from taostest.util import file
77
import sys
8+
import time
89
class EMSEdge(TDCase):
910
def init(self):
1011
self.yml_name = sys.argv[1].split("=")[1]
@@ -64,6 +65,11 @@ def run(self):
6465
task_info = response.json()
6566
task_list.append(task_info["id"])
6667

68+
task_start_time = time.time()
69+
self.case_config["task_start_time"] = task_start_time
70+
with open(os.path.join(self.env_root, "workflow_config.json"), "w") as config_file:
71+
json.dump(self.case_config, config_file, indent=4)
72+
6773
# time.sleep(self.execute_time)
6874

6975
# for task_id in task_list:

tests/cases/customer_scenarios/ems/ems_summary.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def init(self):
3535
self.taosd_url = f'http://{self.center_first_ep_host}:6041/rest/sql'
3636
self.taosd_headers = {"Authorization": "Basic cm9vdDp0YW9zZGF0YQ=="}
3737
self.mqtt_received_bytes = 0
38+
self.task_run_time = int(self.case_config["exec_time"]) - (self.case_config["task_start_time"] - self.case_config["mqtt_start_time"])
3839
self.test_robot_url = (
3940
"https://open.feishu.cn/open-apis/bot/v2/hook/11e9e452-34a0-4c88-b014-10e21cb521dd"
4041
)
@@ -95,6 +96,7 @@ def validate_sync(self):
9596
stable_counter = 0
9697

9798
while time.time() - start_time < self.retention_timeout:
99+
edge_total = self.collect_edge_data()
98100
current_center = self._get_center_data()
99101
self._remote._logger.info(f'current edge data: {edge_total}')
100102
self._remote._logger.info(f'current center data: {current_center}')
@@ -119,6 +121,15 @@ def validate_sync(self):
119121
ratio = final_center / edge_total if edge_total > 0 else 0
120122
return [f"{round(ratio*100, 2)}%", final_center, edge_total]
121123

124+
def write_final_edge_perf(self, insert_perf):
125+
for node, perf_info in list(zip(self.edge_host_list, insert_perf)):
126+
if perf_info["host"] == node:
127+
perf_info["total_written_rows"] = self.stable_data[node]
128+
perf_info["total_rows_per_second"] = round(self.stable_data[node]/self.task_run_time, 2)
129+
perf_info["total_points_per_second"] = round(perf_info["total_written_rows"]/self.task_run_time, 2)
130+
perf_info["total_rows_per_second"] = self.stable_data[node]
131+
return perf_info
132+
122133
def _get_center_data(self) -> int:
123134
stables = self._get_stables(self.center_first_ep_host, self.center_dbname)
124135
return sum(self._get_table_count(self.center_first_ep_host, stable, self.center_dbname) for stable in stables)
@@ -288,6 +299,7 @@ def run(self):
288299
data_retention_info["center_total_rows"] = center_total_rows
289300
data_retention_info["edge_total_rows"] = edge_total_rows
290301
insert_perf = self.get_insert_result()
302+
insert_perf_info = self.write_final_edge_perf(insert_perf)
291303
query_perf = self.get_query_detail_result()
292304
compression_ratio_disk_info = self.get_compression_ratio()
293305
compression_data_size = self._get_compression_data()
@@ -296,7 +308,7 @@ def run(self):
296308
test_specs = self.get_test_specs()
297309
final_res_dict = {
298310
"Test Specs": test_specs,
299-
"Insert Performance": insert_perf,
311+
"Insert Performance": insert_perf_info,
300312
"Query Performance": query_perf,
301313
"Compression Ratio": compression_ratio,
302314
"Data Retention Info": data_retention_info,

tests/cases/customer_scenarios/ems/get_metrics.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from datetime import datetime, timedelta
2121
from taostest.util.rest import TDRest
2222

23-
class Stop(TDCase):
23+
class GetMetrics(TDCase):
2424
def init(self):
2525
self.tdCom = TDCom(self.tdSql)
2626
self._remote: Remote = Remote(self.logger)
@@ -73,10 +73,11 @@ def run(self) -> bool:
7373
query_summary_metrics = {
7474
"role": self.get_role(),
7575
"host": self.host,
76-
"total_rows_per_second":0,
77-
"total_points_per_second":0,
78-
"total_written_rows":0,
79-
"total_written_points":0,
76+
"total_rows_per_second": 0,
77+
"total_points_per_second": 0,
78+
"total_written_rows": 0,
79+
"total_written_points": 0,
80+
"total_written_points": 0,
8081
"mqtt_received_bytes": 0
8182
}
8283
tmq_summary_metrics = {
@@ -96,10 +97,7 @@ def run(self) -> bool:
9697
# query_summary_metrics["total_inserted_sqls"] += metrics_dict[task_id]["total"]["total_inserted_sqls"]
9798
if "total_points_per_second" in metrics_dict[task_id]["total"]:
9899
self.api_type = 0
99-
query_summary_metrics["total_points_per_second"] += round(metrics_dict[task_id]["total"]["total_points_per_second"], 2)
100100
query_summary_metrics["total_written_points"] += round(metrics_dict[task_id]["total"]["total_written_points"], 2)
101-
query_summary_metrics["total_written_rows"] += round(metrics_dict[task_id]["total"]["total_written_rows"], 2)
102-
query_summary_metrics["total_rows_per_second"] += round(metrics_dict[task_id]["total"]["total_rows_per_second"], 2)
103101
if "mqtt_received_bytes" in metrics_dict[task_id]["current"]:
104102
query_summary_metrics["mqtt_received_bytes"] += round(metrics_dict[task_id]["current"]["mqtt_received_bytes"], 2)
105103
else:

tests/cases/customer_scenarios/ems/start.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import json
2121
from pathlib import Path
2222
import toml
23+
import time
2324
class Start(TDCase):
2425
def init(self):
2526
# mqtt_data_source: $mqttDataSource,
@@ -93,7 +94,10 @@ def start_battery_storage_datain(self):
9394
for mqtt_toml in self.toml_file_list:
9495
self._remote.put(mqtt_host, mqtt_toml, os.path.dirname(mqtt_toml))
9596
cmd_list.append(f"screen -L -Logfile /var/log/taos/{Path(mqtt_toml).stem}.log -d -m mqtt_pub --csv-file /opt/battery_storage_data.csv --csv-header topic,payload,qos,a,b,c --schema {mqtt_toml} --host {edge_host} --interval {mqtt_pub_interval}ms --exec-duration {exec_time}s")
96-
self._remote.cmd(mqtt_host, cmd_list)
97+
mqtt_start_time = time.time()
98+
self.case_config["mqtt_start_time"] = mqtt_start_time
99+
with open(os.path.join(self.env_root, "workflow_config.json"), "w") as config_file:
100+
json.dump(self.case_config, config_file, indent=4)
97101

98102
def start_taosx_service(self,host):
99103
self._remote.cmd(host,"systemctl stop taos-explorer")

0 commit comments

Comments
 (0)