-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8390c23
commit 440c81e
Showing
11 changed files
with
71 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import yatest.common | ||
|
||
|
||
def get_pool(self, ydb_cli_path, endpoint, database, user, query): | ||
# It's funny, but the only way to find resource pool that was used is to use YDB CLI | ||
|
||
command = [ | ||
ydb_cli_path, | ||
'-e', 'grpc://' + endpoint, | ||
'-d', database, | ||
"--user", user, | ||
'--no-password', | ||
"sql", | ||
"-s", query, | ||
'--stats', 'full', | ||
'--format', 'json-unicode' | ||
] | ||
|
||
stdout = yatest.common.execute(command, wait=True).stdout.decode("utf-8") | ||
resource_pool_in_use = _find_resource_pool_id(stdout) | ||
return resource_pool_in_use | ||
|
||
|
||
def _find_resource_pool_id(text): | ||
key = '"ResourcePoolId"' | ||
if key in text: | ||
start_idx = text.find(key) + len(key) | ||
# Skip spaces and colon | ||
while start_idx < len(text) and text[start_idx] in ' :': | ||
start_idx += 1 | ||
# Skip opening double quote | ||
if start_idx < len(text) and text[start_idx] == '"': | ||
start_idx += 1 | ||
end_idx = text.find('"', start_idx) | ||
if end_idx != -1: | ||
return text[start_idx:end_idx] | ||
return None |
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
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
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,4 @@ | ||
def split_data_into_fixed_size_chunks(data, chunk_size): | ||
"""Splits data to N chunks of chunk_size size""" | ||
for i in range(0, len(data), chunk_size): | ||
yield data[i:i + chunk_size] |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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