Skip to content

Commit 432232d

Browse files
committed
try fix charts
1 parent 4c5593f commit 432232d

File tree

5 files changed

+37
-15
lines changed

5 files changed

+37
-15
lines changed

.github/workflows/slo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ jobs:
5252
language0: Python SDK over Table Service
5353
workload_path0: tests/slo
5454
workload_build_context0: ../..
55-
workload_build_options0: -f Dockerfile --build-arg SDK_SERVICE=table-service
55+
workload_build_options0: -f Dockerfile --build-arg SDK_SERVICE=sync-python-table
5656

5757
language_id1: sync-python-query
5858
language1: Python SDK over Query Service
5959
workload_path1: tests/slo
6060
workload_build_context1: ../..
61-
workload_build_options1: -f Dockerfile --build-arg SDK_SERVICE=query-service
61+
workload_build_options1: -f Dockerfile --build-arg SDK_SERVICE=sync-python-query
6262

6363
- uses: actions/upload-artifact@v3
6464
if: env.DOCKER_REPO != null

tests/slo/src/jobs.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131
);
3232
"""
3333

34+
QUERY_READ_QUERY_TEMPLATE = """
35+
SELECT * FROM `{}` WHERE object_id = $object_id AND object_hash = Digest::NumericHash($object_id);
36+
"""
37+
38+
QUERY_WRITE_QUERY_TEMPLATE = """
39+
UPSERT INTO `{}` (
40+
object_id, object_hash, payload_str, payload_double, payload_timestamp
41+
) VALUES (
42+
$object_id, Digest::NumericHash($object_id), $payload_str, $payload_double, $payload_timestamp
43+
);
44+
"""
45+
3446
logger = logging.getLogger(__name__)
3547

3648

@@ -150,12 +162,12 @@ def run_reads_query(driver, query, max_id, metrics, limiter, runtime, timeout):
150162
logger.info("Session pool for read requests created")
151163

152164
while time.time() - start_time < runtime:
153-
params = {"$object_id": randint(1, max_id)}
165+
params = {"$object_id": (randint(1, max_id), ydb.PrimitiveType.Uint64)}
154166
with limiter:
155167

156168
def check_result(result):
157169
res = next(result)
158-
assert res[0].rows[0]
170+
assert res.rows[0]
159171

160172
params = RequestParams(
161173
pool=pool,
@@ -175,7 +187,7 @@ def check_result(result):
175187
def run_read_jobs_query(args, driver, tb_name, max_id, metrics):
176188
logger.info("Start read jobs for query service")
177189

178-
read_q = READ_QUERY_TEMPLATE.format(tb_name)
190+
read_q = QUERY_READ_QUERY_TEMPLATE.format(tb_name)
179191

180192
read_limiter = RateLimiter(max_calls=args.read_rps, period=1)
181193
futures = []
@@ -213,10 +225,6 @@ def run_writes(driver, query, row_generator, metrics, limiter, runtime, timeout)
213225
"$payload_timestamp": row.payload_timestamp,
214226
}
215227

216-
def check_result(result):
217-
with result:
218-
pass
219-
220228
with limiter:
221229
params = RequestParams(
222230
pool=pool,
@@ -226,7 +234,6 @@ def check_result(result):
226234
labels=(JOB_WRITE_LABEL,),
227235
request_settings=request_settings,
228236
retry_settings=retry_setting,
229-
check_result_cb=check_result,
230237
)
231238
execute_query(params)
232239

@@ -272,11 +279,16 @@ def run_writes_query(driver, query, row_generator, metrics, limiter, runtime, ti
272279
while time.time() - start_time < runtime:
273280
row = row_generator.get()
274281
params = {
275-
"$object_id": (row.object_id, ydb.PrimitiveType.Int64),
282+
"$object_id": (row.object_id, ydb.PrimitiveType.Uint64),
276283
"$payload_str": (row.payload_str, ydb.PrimitiveType.Utf8),
277284
"$payload_double": (row.payload_double, ydb.PrimitiveType.Double),
278285
"$payload_timestamp": (row.payload_timestamp, ydb.PrimitiveType.Timestamp),
279286
}
287+
288+
def check_result(result):
289+
with result:
290+
pass
291+
280292
with limiter:
281293
params = RequestParams(
282294
pool=pool,
@@ -286,6 +298,7 @@ def run_writes_query(driver, query, row_generator, metrics, limiter, runtime, ti
286298
labels=(JOB_WRITE_LABEL,),
287299
request_settings=request_settings,
288300
retry_settings=retry_setting,
301+
check_result_cb=check_result,
289302
)
290303
execute_query(params)
291304

@@ -295,7 +308,7 @@ def run_writes_query(driver, query, row_generator, metrics, limiter, runtime, ti
295308
def run_write_jobs_query(args, driver, tb_name, max_id, metrics):
296309
logger.info("Start write jobs for query service")
297310

298-
write_q = WRITE_QUERY_TEMPLATE.format(tb_name)
311+
write_q = QUERY_WRITE_QUERY_TEMPLATE.format(tb_name)
299312

300313
write_limiter = RateLimiter(max_calls=args.write_rps, period=1)
301314
row_generator = RowGenerator(max_id)

tests/slo/src/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
JOB_READ_LABEL, JOB_WRITE_LABEL = "read", "write"
1414
JOB_STATUS_OK, JOB_STATUS_ERR = "ok", "err"
1515

16-
SDK_SERVICE_NAME = environ.get("SDK_SERVICE", "table-service")
16+
SDK_SERVICE_NAME = environ.get("SDK_SERVICE", "sync-python-table")
1717

1818

1919
class Metrics:

tests/slo/src/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ def run_slo(args, driver, tb_name):
9191
logger.info("Max ID: %s", max_id)
9292

9393
metrics = Metrics(args.prom_pgw)
94-
if SDK_SERVICE_NAME == "table-service":
94+
if SDK_SERVICE_NAME == "sync-python-table":
9595
futures = (
9696
*run_read_jobs(args, driver, tb_name, max_id, metrics),
9797
*run_write_jobs(args, driver, tb_name, max_id, metrics),
9898
run_metric_job(args, metrics),
9999
)
100-
elif SDK_SERVICE_NAME == "query-service":
100+
elif SDK_SERVICE_NAME == "sync-python-query":
101101
futures = (
102102
*run_read_jobs_query(args, driver, tb_name, max_id, metrics),
103103
*run_write_jobs_query(args, driver, tb_name, max_id, metrics),

ydb/query/pool.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ def wrapped_callee():
7777

7878
return retry_operation_sync(wrapped_callee, retry_settings)
7979

80+
def stop(self, timeout=None):
81+
pass
82+
83+
def __enter__(self):
84+
return self
85+
86+
def __exit__(self, exc_type, exc_val, exc_tb):
87+
self.stop()
88+
8089

8190
class SimpleQuerySessionCheckout:
8291
def __init__(self, pool: QuerySessionPool):

0 commit comments

Comments
 (0)