forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude PQ (YDS) Stats from Metering Records (ydb-platform#2440)
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import logging | ||
import time | ||
import json | ||
|
||
from ydb.tests.tools.fq_runner.kikimr_utils import yq_v1 | ||
from ydb.tests.tools.datastreams_helpers.test_yds_base import TestYdsBase | ||
|
||
import ydb.public.api.protos.draft.fq_pb2 as fq | ||
|
||
|
||
class TestKillPqBill(TestYdsBase): | ||
@yq_v1 | ||
def test_do_not_bill_pq(self, kikimr, client): | ||
self.init_topics("no_pq_bill") | ||
|
||
sql = R''' | ||
PRAGMA dq.MaxTasksPerStage="2"; | ||
INSERT INTO yds.`{output_topic}` | ||
SELECT Data AS Data | ||
FROM yds.`{input_topic}`;''' \ | ||
.format( | ||
input_topic=self.input_topic, | ||
output_topic=self.output_topic, | ||
) | ||
|
||
client.create_yds_connection(name="yds", database_id="FakeDatabaseId") | ||
query_id = client.create_query("simple", sql, type=fq.QueryContent.QueryType.STREAMING, | ||
vcpu_time_limit=1).result.query_id | ||
client.wait_query_status(query_id, fq.QueryMeta.RUNNING) | ||
kikimr.compute_plane.wait_zero_checkpoint(query_id) | ||
|
||
data_1mb = ['1' * 1024 * 1024] | ||
message_count = 15 | ||
for _ in range(0, message_count): | ||
self.write_stream(data_1mb) | ||
self.read_stream(message_count) | ||
|
||
client.abort_query(query_id) | ||
client.wait_query_status(query_id, fq.QueryMeta.ABORTED_BY_USER) | ||
|
||
stat = json.loads(client.describe_query(query_id).result.query.statistics.json) | ||
|
||
graph_name = "Graph=0" | ||
ingress_bytes = stat[graph_name]["IngressBytes"]["sum"] | ||
|
||
assert ingress_bytes >= 15 * 1024 * 1024, "Ingress must be >= 15MB" | ||
assert sum(kikimr.control_plane.get_metering()) == 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters