Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions ydb/apps/dstool/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def apply_args(self, args, with_localhost=True):

self.parse_token(args.token_file)
self.domain = 1
self.verbose = args.verbose
self.verbose = args.verbose or args.debug
self.debug = args.debug
self.quiet = args.quiet
self.http_timeout = args.http_timeout
self.cafile = args.cafile
Expand All @@ -210,6 +211,7 @@ def apply_args(self, args, with_localhost=True):
def add_host_access_options(self, parser, with_endpoint=True):
self.parser = parser
parser.add_argument('--verbose', '-v', action='store_true', help='Be verbose during operation')
parser.add_argument('--debug', '-d', action='store_true', help='Be very verbose during operation')
parser.add_argument('--quiet', '-q', action='store_true', help="Don't show non-vital messages")
g = parser.add_argument_group('Server access options')
if with_endpoint:
Expand Down Expand Up @@ -440,7 +442,7 @@ def fetch(path, params={}, explicit_host=None, fmt='json', host=None, cache=True
if endpoint.protocol not in ('http', 'https'):
endpoint = connection_params.make_endpoint_info(f'{connection_params.mon_protocol}://{endpoint.host_with_mon_port}')
url = connection_params.make_url(endpoint, path, params)
if connection_params.verbose:
if connection_params.debug:
print('INFO: fetching %s' % url, file=sys.stderr)
request = urllib.request.Request(url, data=data, method=method)
if connection_params.token and url.startswith('http'):
Expand All @@ -467,7 +469,7 @@ def invoke_grpc(func, *params, explicit_host=None, endpoint=None):
options = [
('grpc.max_receive_message_length', 256 << 20), # 256 MiB
]
if connection_params.verbose:
if connection_params.debug:
p = ', '.join('<<< %s >>>' % text_format.MessageToString(param, as_one_line=True) for param in params)
print('INFO: issuing %s(%s) @%s:%d protocol %s' % (func, p, endpoint.host, endpoint.grpc_port,
endpoint.protocol), file=sys.stderr)
Expand All @@ -476,11 +478,11 @@ def work(channel):
try:
stub = kikimr_grpc.TGRpcServerStub(channel)
res = getattr(stub, func)(*params)
if connection_params.verbose:
if connection_params.debug:
print('INFO: result <<< %s >>>' % text_format.MessageToString(res, as_one_line=True), file=sys.stderr)
return res
except Exception as e:
if connection_params.verbose:
if connection_params.debug:
print('ERROR: exception %s' % e, file=sys.stderr)
raise ConnectionError("Can't connect to specified addresses by gRPC protocol")

Expand Down
Loading