[AI]
Offering: openGaussDev More detail: Match-id-1aa4ebbfa370ed5029291d6443f619edd9c0d20f
This commit is contained in:
@ -16,7 +16,7 @@ except ImportError:
|
||||
import sys
|
||||
import os
|
||||
|
||||
curr_path = os.path.dirname(os.path.abspath(__file__))
|
||||
curr_path = os.path.dirname(os.path.realpath(__file__))
|
||||
root_path = os.path.dirname(curr_path)
|
||||
sys.path.append(root_path)
|
||||
from dbmind.cmd import main
|
||||
|
@ -126,7 +126,7 @@ def load_sys_configs(confile):
|
||||
class ConfigUpdater:
|
||||
def __init__(self, filepath):
|
||||
self.config = ConfigParser(inline_comment_prefixes=None)
|
||||
self.filepath = os.path.abspath(filepath)
|
||||
self.filepath = os.path.realpath(filepath)
|
||||
self.fp = None
|
||||
self.readonly = True
|
||||
|
||||
|
@ -90,7 +90,7 @@ class DBMindMain(Daemon):
|
||||
if not _check_confpath(confpath):
|
||||
raise SetupError("Invalid directory '%s', please set up first." % confpath)
|
||||
|
||||
self.confpath = os.path.abspath(confpath)
|
||||
self.confpath = os.path.realpath(confpath)
|
||||
self.worker = None
|
||||
|
||||
pid_file = os.path.join(confpath, constants.PIDFILE_NAME)
|
||||
|
@ -35,7 +35,7 @@ from dbmind.metadatabase.dao.dynamic_config import dynamic_config_set, dynamic_c
|
||||
def initialize_and_check_config(confpath, interactive=False):
|
||||
if not os.path.exists(confpath):
|
||||
raise SetupError('Not found the directory %s.' % confpath)
|
||||
confpath = os.path.abspath(confpath) # in case of dir changed.
|
||||
confpath = os.path.realpath(confpath) # in case of dir changed.
|
||||
os.chdir(confpath)
|
||||
dbmind_conf_path = os.path.join(confpath, constants.CONFILE_NAME)
|
||||
dynamic_config_path = os.path.join(confpath, constants.DYNAMIC_CONFIG)
|
||||
|
@ -63,7 +63,7 @@ class Daemon:
|
||||
RUNNING = 1
|
||||
|
||||
def __init__(self, pid_file, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
|
||||
self.pid_file = os.path.abspath(pid_file)
|
||||
self.pid_file = os.path.realpath(pid_file)
|
||||
self.stdin = stdin
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
@ -20,7 +20,7 @@ from dbmind.common.utils import where_am_i
|
||||
|
||||
def list_components():
|
||||
"""Return all components in current directory."""
|
||||
curr_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
curr_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
components = list(
|
||||
map(lambda tup: tup[1],
|
||||
pkgutil.iter_modules((curr_dir,)))
|
||||
|
@ -57,7 +57,7 @@ def show(metric, host, start_time, end_time):
|
||||
for row_ in result:
|
||||
row = [str(getattr(row_, field)).strip() for field in field_names]
|
||||
csv_writer.writerow(row)
|
||||
write_to_terminal('Dumped file is %s.' % os.path.abspath(dump_file_name))
|
||||
write_to_terminal('Dumped file is %s.' % os.path.realpath(dump_file_name))
|
||||
elif char == 'N':
|
||||
print(output_table)
|
||||
print('(%d rows)' % nb_rows)
|
||||
|
@ -17,7 +17,7 @@ import os
|
||||
try:
|
||||
from dbmind.components.index_advisor import main
|
||||
except ImportError:
|
||||
libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||
libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
sys.path.append(libpath)
|
||||
from index_advisor import main
|
||||
|
||||
|
@ -16,7 +16,7 @@ import os
|
||||
try:
|
||||
from dbmind.components.opengauss_exporter import main
|
||||
except ImportError:
|
||||
libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||
libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
sys.path.append(libpath)
|
||||
from opengauss_exporter import main
|
||||
|
||||
|
@ -29,7 +29,7 @@ from . import controller
|
||||
from . import service
|
||||
from .. import __version__
|
||||
|
||||
ROOT_DIR_PATH = os.path.abspath(
|
||||
ROOT_DIR_PATH = os.path.realpath(
|
||||
os.path.join(os.path.dirname(__file__), '..')
|
||||
)
|
||||
|
||||
@ -70,7 +70,7 @@ def wipe_off_password(dsn):
|
||||
|
||||
def path_type(path):
|
||||
if os.path.exists(path):
|
||||
return os.path.abspath(path)
|
||||
return os.path.realpath(path)
|
||||
else:
|
||||
raise argparse.ArgumentTypeError('%s is not a valid path.' % path)
|
||||
|
||||
@ -102,7 +102,7 @@ def parse_argv(argv):
|
||||
parser.add_argument('--ssl-certfile', type=path_type, help='set the path of ssl certificate file')
|
||||
parser.add_argument('--parallel', default=5, type=int,
|
||||
help='not collect pg_settings.yml metrics.')
|
||||
parser.add_argument('--log.filepath', type=os.path.abspath, default=os.path.join(os.getcwd(), DEFAULT_LOGFILE),
|
||||
parser.add_argument('--log.filepath', type=os.path.realpath, default=os.path.join(os.getcwd(), DEFAULT_LOGFILE),
|
||||
help='the path to log')
|
||||
parser.add_argument('--log.level', default='info', choices=('debug', 'info', 'warn', 'error', 'fatal'),
|
||||
help='only log messages with the given severity or above.'
|
||||
|
@ -16,7 +16,7 @@ import os
|
||||
try:
|
||||
from dbmind.components.reprocessing_exporter import main
|
||||
except ImportError:
|
||||
libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||
libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
sys.path.append(libpath)
|
||||
from reprocessing_exporter import main
|
||||
|
||||
|
@ -24,7 +24,7 @@ from . import dao
|
||||
from . import service
|
||||
from .. import __version__
|
||||
|
||||
CURR_DIR = os.path.abspath(
|
||||
CURR_DIR = os.path.realpath(
|
||||
os.path.join(os.path.dirname(__file__), '..')
|
||||
)
|
||||
DEFAULT_YAML = 'reprocessing_exporter.yml'
|
||||
@ -35,7 +35,7 @@ with tempfile.NamedTemporaryFile(suffix='.pid') as fp:
|
||||
|
||||
def path_type(path):
|
||||
if os.path.exists(path):
|
||||
return os.path.abspath(path)
|
||||
return os.path.realpath(path)
|
||||
else:
|
||||
raise argparse.ArgumentTypeError('%s is not a valid path.' % path)
|
||||
|
||||
@ -56,7 +56,7 @@ def parse_argv(argv):
|
||||
help='listen port to expose metrics and web interface')
|
||||
parser.add_argument('--collector.config', type=path_type, default=os.path.join(CURR_DIR, DEFAULT_YAML),
|
||||
help='according to the content of the yaml file for metric collection')
|
||||
parser.add_argument('--log.filepath', type=os.path.abspath,
|
||||
parser.add_argument('--log.filepath', type=os.path.realpath,
|
||||
default=os.path.join(os.getcwd(), DEFAULT_LOGFILE),
|
||||
help='the path to log')
|
||||
parser.add_argument('--log.level', default='info', choices=('debug', 'info', 'warn', 'error', 'fatal'),
|
||||
|
@ -51,7 +51,7 @@ def show(query, start_time, end_time):
|
||||
dump_file_name = 'slow_queries_%s.txt' % int(time.time())
|
||||
with open(dump_file_name, 'w+') as fp:
|
||||
fp.write(str(output_table))
|
||||
write_to_terminal('Dumped file is %s.' % os.path.abspath(dump_file_name))
|
||||
write_to_terminal('Dumped file is %s.' % os.path.realpath(dump_file_name))
|
||||
elif char == 'N':
|
||||
print(output_table)
|
||||
print('(%d rows)' % nb_rows)
|
||||
|
@ -17,7 +17,7 @@ import os
|
||||
try:
|
||||
from dbmind.components.sqldiag import main
|
||||
except ImportError:
|
||||
libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||
libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
sys.path.append(libpath)
|
||||
from sqldiag import main
|
||||
|
||||
|
@ -132,8 +132,8 @@ def check_time_legality(time_string):
|
||||
def is_valid_conf(filepath):
|
||||
if os.path.exists(filepath):
|
||||
file_abs_path = filepath
|
||||
elif os.path.exists(os.path.abspath(os.path.join(os.getcwd(), filepath))):
|
||||
file_abs_path = os.path.abspath(os.path.join(os.getcwd(), filepath))
|
||||
elif os.path.exists(os.path.realpath(os.path.join(os.getcwd(), filepath))):
|
||||
file_abs_path = os.path.realpath(os.path.join(os.getcwd(), filepath))
|
||||
else:
|
||||
print("FATAL: Not found the configuration file %s." % filepath, file=sys.stderr)
|
||||
return False
|
||||
|
@ -17,7 +17,7 @@ import os
|
||||
try:
|
||||
from dbmind.components.xtuner.tuner.main import main
|
||||
except ImportError:
|
||||
libpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
|
||||
libpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
|
||||
sys.path.append(libpath)
|
||||
|
||||
from xtuner.tuner.main import main
|
||||
|
@ -15,7 +15,7 @@ import os
|
||||
__version__ = '1.0.0'
|
||||
__description__ = 'openGauss DBMind: An autonomous platform for openGauss'
|
||||
|
||||
DBMIND_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
DBMIND_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
MISC_PATH = os.path.join(DBMIND_PATH, 'misc')
|
||||
|
||||
CONFILE_NAME = 'dbmind.conf' # the name of configuration file
|
||||
|
@ -20,7 +20,7 @@ import dbmind.common.process
|
||||
from dbmind.common.daemon import Daemon
|
||||
from dbmind.common.platform import WIN32
|
||||
|
||||
BASEPATH = os.path.abspath(os.path.dirname(__file__))
|
||||
BASEPATH = os.path.realpath(os.path.dirname(__file__))
|
||||
PID_NAME = 'tester.pid'
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ import os
|
||||
from dbmind.constants import METRIC_MAP_CONFIG, MISC_PATH
|
||||
from dbmind.common import utils
|
||||
|
||||
CURR_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
CURR_DIR = os.path.realpath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def test_read_simple_conf_file():
|
||||
|
Reference in New Issue
Block a user