aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ydb/public/tools/lib/cmds/__init__.py4
-rw-r--r--ydb/public/tools/local_ydb/__main__.py4
-rw-r--r--ydb/tests/library/harness/daemon.py27
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py13
4 files changed, 35 insertions, 13 deletions
diff --git a/ydb/public/tools/lib/cmds/__init__.py b/ydb/public/tools/lib/cmds/__init__.py
index b6c27419e0..fbcb9ef48b 100644
--- a/ydb/public/tools/lib/cmds/__init__.py
+++ b/ydb/public/tools/lib/cmds/__init__.py
@@ -30,6 +30,7 @@ class EmptyArguments(object):
self.debug_logging = []
self.fixed_ports = False
self.public_http_config_path = None
+ self.dont_use_log_files = False
def ensure_path_exists(path):
@@ -300,6 +301,7 @@ def deploy(arguments):
fq_config_path=arguments.fq_config_path,
public_http_config_path=arguments.public_http_config_path,
auth_config_path=arguments.auth_config_path,
+ use_log_files=not arguments.dont_use_log_files,
**optionals
)
@@ -383,7 +385,7 @@ def _cleanup_working_dir(arguments):
def start(arguments):
recipe = Recipe(arguments)
- info = Recipe(arguments).read_metafile()
+ info = recipe.read_metafile()
for node_id, node_meta in info['nodes'].items():
files = {}
if os.path.exists(node_meta['stderr_file']):
diff --git a/ydb/public/tools/local_ydb/__main__.py b/ydb/public/tools/local_ydb/__main__.py
index 98862bcd28..5179a51929 100644
--- a/ydb/public/tools/local_ydb/__main__.py
+++ b/ydb/public/tools/local_ydb/__main__.py
@@ -132,6 +132,10 @@ To update cluster (stop + start):
'--public-http-config-path', default=None,
help='The path to public HTTP config'
)
+ sub_parser.add_argument(
+ '--dont-use-log-files', default=False, action='store_true',
+ help='Don\'t use log files (only STDOUT and STDERR output)'
+ )
arguments = parser.parse_args()
arguments.ydb_working_dir = cmds.wrap_path(arguments.ydb_working_dir)
diff --git a/ydb/tests/library/harness/daemon.py b/ydb/tests/library/harness/daemon.py
index c34c7ce927..1bff987f71 100644
--- a/ydb/tests/library/harness/daemon.py
+++ b/ydb/tests/library/harness/daemon.py
@@ -3,9 +3,8 @@ import abc
import logging
import os
import signal
-import tempfile
-import subprocess
import sys
+import subprocess
from yatest.common import process
import six
@@ -66,11 +65,10 @@ class Daemon(object):
self.__killed = False
self.__core_pattern = core_pattern
self.logger = logger.getChild(self.__class__.__name__)
- if stdout_file is None:
- self.__stdout_file = tempfile.NamedTemporaryFile(dir=self.__cwd, prefix="stdout_", delete=False)
- self.__stderr_file = tempfile.NamedTemporaryFile(dir=self.__cwd, prefix="stderr_", delete=False)
- self.__stdin_file = tempfile.NamedTemporaryFile(dir=self.__cwd, prefix="stdin_", delete=False)
- else:
+ self.__stdout_file = sys.stdout
+ self.__stdin_file = sys.stdin
+ self.__stderr_file = sys.stderr
+ if stdout_file is not None:
self.__stdout_file = open(stdout_file, mode='w+b')
self.__stdin_file = open(stdin_file, mode='w+b')
self.__stderr_file = open(stderr_file, mode='w+b')
@@ -81,15 +79,24 @@ class Daemon(object):
@property
def stdin_file_name(self):
- return os.path.abspath(self.__stdin_file.name)
+ if self.__stdin_file is not sys.stdin:
+ return os.path.abspath(self.__stdin_file.name)
+ else:
+ return None
@property
def stdout_file_name(self):
- return os.path.abspath(self.__stdout_file.name)
+ if self.__stdout_file is not sys.stdout:
+ return os.path.abspath(self.__stdout_file.name)
+ else:
+ return None
@property
def stderr_file_name(self):
- return os.path.abspath(self.__stderr_file.name)
+ if self.__stderr_file is not sys.stderr:
+ return os.path.abspath(self.__stderr_file.name)
+ else:
+ return None
def is_alive(self):
return self.__daemon is not None and self.__daemon.running
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index 73a708c9b1..0d0a1fd777 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -74,7 +74,12 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
self.__role = role
self.__node_broker_port = node_broker_port
- self.__log_file = tempfile.NamedTemporaryFile(dir=self.cwd, prefix="logfile_", suffix=".log", delete=False)
+
+ if configurator.use_log_files:
+ self.__log_file = tempfile.NamedTemporaryFile(dir=self.cwd, prefix="logfile_", suffix=".log", delete=False)
+ else:
+ self.__log_file = None
+
self.__cms_config_cache_file = tempfile.NamedTemporaryFile(
dir=self.cwd,
prefix="cms_config_cache_",
@@ -166,10 +171,14 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface):
"--node-kind=%s" % self.__configurator.node_kind
)
+ if self.__log_file is not None:
+ command.append(
+ "--log-file-name=%s" % self.__log_file.name,
+ )
+
command.extend(
[
"--yaml-config=%s" % join(self.__config_path, "config.yaml"),
- "--log-file-name=%s" % self.__log_file.name,
"--grpc-port=%s" % self.grpc_port,
"--mon-port=%d" % self.mon_port,
"--ic-port=%d" % self.ic_port,