Skip to content

Commit 7004bd8

Browse files
authored
Merge 7821d97 into 280a19d
2 parents 280a19d + 7821d97 commit 7004bd8

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
@@ -142,7 +142,8 @@ def apply_args(self, args, with_localhost=True):
142142

143143
self.parse_token(args.token_file)
144144
self.domain = 1
145-
self.verbose = args.verbose
145+
self.verbose = args.verbose or args.debug
146+
self.debug = args.debug
146147
self.quiet = args.quiet
147148
self.http_timeout = args.http_timeout
148149
self.cafile = args.cafile
@@ -151,6 +152,7 @@ def apply_args(self, args, with_localhost=True):
151152

152153
def add_host_access_options(self, parser, with_endpoint=True):
153154
parser.add_argument('--verbose', '-v', action='store_true', help='Be verbose during operation')
155+
parser.add_argument('--debug', '-d', action='store_true', help='Be very verbose during operation')
154156
parser.add_argument('--quiet', '-q', action='store_true', help="Don't show non-vital messages")
155157
g = parser.add_argument_group('Server access options')
156158
if with_endpoint:
@@ -299,7 +301,7 @@ def wrapped(*args, **kwargs):
299301
@query_random_host_with_retry(explicit_host_param='explicit_host', http=True)
300302
def fetch(path, params={}, explicit_host=None, fmt='json', host=None, cache=True, method=None, data=None, content_type=None, accept=None):
301303
url = connection_params.make_url(host, path, params)
302-
if connection_params.verbose:
304+
if connection_params.debug:
303305
print('INFO: fetching %s' % url, file=sys.stderr)
304306
request = urllib.request.Request(url, data=data, method=method)
305307
if connection_params.token and url.startswith('http'):
@@ -326,7 +328,7 @@ def invoke_grpc(func, *params, explicit_host=None, host=None):
326328
options = [
327329
('grpc.max_receive_message_length', 256 << 20), # 256 MiB
328330
]
329-
if connection_params.verbose:
331+
if connection_params.debug:
330332
p = ', '.join('<<< %s >>>' % text_format.MessageToString(param, as_one_line=True) for param in params)
331333
print('INFO: issuing %s(%s) @%s:%d protocol %s' % (func, p, host, connection_params.grpc_port,
332334
connection_params.mon_protocol), file=sys.stderr)
@@ -335,11 +337,11 @@ def work(channel):
335337
try:
336338
stub = kikimr_grpc.TGRpcServerStub(channel)
337339
res = getattr(stub, func)(*params)
338-
if connection_params.verbose:
340+
if connection_params.debug:
339341
print('INFO: result <<< %s >>>' % text_format.MessageToString(res, as_one_line=True), file=sys.stderr)
340342
return res
341343
except Exception as e:
342-
if connection_params.verbose:
344+
if connection_params.debug:
343345
print('ERROR: exception %s' % e, file=sys.stderr)
344346
raise ConnectionError("Can't connect to specified addresses by gRPC protocol")
345347

0 commit comments

Comments
 (0)