Skip to content

Commit 2058d8c

Browse files
authored
Add group_slots option to balance in ydb-dstool (#11589)
1 parent 2cf848f commit 2058d8c

File tree

2 files changed

+583
-232
lines changed

2 files changed

+583
-232
lines changed

ydb/apps/dstool/lib/common.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ def apply_args(self, args, with_localhost=True):
201201

202202
self.parse_token(args.token_file)
203203
self.domain = 1
204-
self.verbose = args.verbose
204+
self.verbose = args.verbose or args.debug
205+
self.debug = args.debug
205206
self.quiet = args.quiet
206207
self.http_timeout = args.http_timeout
207208
self.cafile = args.cafile
@@ -210,6 +211,7 @@ def apply_args(self, args, with_localhost=True):
210211
def add_host_access_options(self, parser, with_endpoint=True):
211212
self.parser = parser
212213
parser.add_argument('--verbose', '-v', action='store_true', help='Be verbose during operation')
214+
parser.add_argument('--debug', '-d', action='store_true', help='Be very verbose during operation')
213215
parser.add_argument('--quiet', '-q', action='store_true', help="Don't show non-vital messages")
214216
g = parser.add_argument_group('Server access options')
215217
if with_endpoint:
@@ -440,7 +442,7 @@ def fetch(path, params={}, explicit_host=None, fmt='json', host=None, cache=True
440442
if endpoint.protocol not in ('http', 'https'):
441443
endpoint = connection_params.make_endpoint_info(f'{connection_params.mon_protocol}://{endpoint.host_with_mon_port}')
442444
url = connection_params.make_url(endpoint, path, params)
443-
if connection_params.verbose:
445+
if connection_params.debug:
444446
print('INFO: fetching %s' % url, file=sys.stderr)
445447
request = urllib.request.Request(url, data=data, method=method)
446448
if connection_params.token and url.startswith('http'):
@@ -467,7 +469,7 @@ def invoke_grpc(func, *params, explicit_host=None, endpoint=None):
467469
options = [
468470
('grpc.max_receive_message_length', 256 << 20), # 256 MiB
469471
]
470-
if connection_params.verbose:
472+
if connection_params.debug:
471473
p = ', '.join('<<< %s >>>' % text_format.MessageToString(param, as_one_line=True) for param in params)
472474
print('INFO: issuing %s(%s) @%s:%d protocol %s' % (func, p, endpoint.host, endpoint.grpc_port,
473475
endpoint.protocol), file=sys.stderr)
@@ -476,11 +478,11 @@ def work(channel):
476478
try:
477479
stub = kikimr_grpc.TGRpcServerStub(channel)
478480
res = getattr(stub, func)(*params)
479-
if connection_params.verbose:
481+
if connection_params.debug:
480482
print('INFO: result <<< %s >>>' % text_format.MessageToString(res, as_one_line=True), file=sys.stderr)
481483
return res
482484
except Exception as e:
483-
if connection_params.verbose:
485+
if connection_params.debug:
484486
print('ERROR: exception %s' % e, file=sys.stderr)
485487
raise ConnectionError("Can't connect to specified addresses by gRPC protocol")
486488

0 commit comments

Comments
 (0)