1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

feat(mcs): add -v option to enable logging to console

refactor(ci): switch S3 uploading to AWS CLI for logging S3 link

docs: update README with to reflect changes in Drone pipeline

feat(env): add activate script for portable Python

fix(logging): log RequestException response body
This commit is contained in:
Alexander Presnyakov
2025-03-12 17:26:20 +00:00
parent a329f4d428
commit de7a4a2d7e
13 changed files with 133 additions and 23 deletions

View File

@ -262,7 +262,7 @@ dispatcher.connect(
def jsonify_error(status, message, traceback, version): \
# pylint: disable=unused-argument
# pylint: disable=unused-argument
"""JSONify all CherryPy error responses (created by raising the
cherrypy.HTTPError exception)
"""

View File

@ -417,7 +417,7 @@ class ConfigController:
)
if in_maintenance_state():
module_logger.info(
'Maintaninance state is active in new config. '
'Maintenance state is active in new config. '
'MCS processes should not be started.'
)
cherrypy.engine.publish('failover', False)

View File

@ -372,6 +372,11 @@ def broadcast_new_config(
logging.warning(
f'Timeout while pushing new config to "{node}"'
)
except requests.exceptions.RequestException as e:
logging.warning(
'Error while pushing new config to "%s": %s"', node, str(e)
)
logging.debug('Response: %s', r.text)
except Exception as e:
logging.warning(
f'Got an unexpected error pushing new config to "{node}"',
@ -461,7 +466,7 @@ def get_config_parser(
except PermissionError as e:
# TODO: looks like it's useless here, because of creating config
# from default on cmapi server startup
# Anyway looks like it have to raise error and then
# Anyway looks like it has to raise error and then
# return 500 error
logging.error(
'CMAPI cannot create configuration file. '
@ -826,7 +831,7 @@ def cmapi_config_check(cmapi_conf_path: str = CMAPI_CONF_PATH):
"""
if not os.path.exists(cmapi_conf_path):
logging.info(
f'There are no config file at "{cmapi_conf_path}". '
f'There is no config file at "{cmapi_conf_path}". '
f'So copy default config from {CMAPI_DEFAULT_CONF_PATH} there.'
)
copyfile(CMAPI_DEFAULT_CONF_PATH, cmapi_conf_path)

View File

@ -95,6 +95,12 @@ def add_logging_level(level_name, level_num, method_name=None):
setattr(logging, method_name, partial(logging.log, level_num))
def enable_console_logging(logger: logging.Logger) -> None:
"""Enable logging to console for passed logger by adding a StreamHandler to it"""
console_handler = logging.StreamHandler()
logger.addHandler(console_handler)
def config_cmapi_server_logging():
# add custom level TRACE only for develop purposes
# could be activated using API endpoints or cli tool without relaunching

View File

@ -55,7 +55,7 @@ def switch_node_maintenance(
maintenance_element = etree.SubElement(config_root, 'Maintenance')
maintenance_element.text = str(maintenance_state).lower()
node_config.write_config(config_root, filename=output_config_filename)
# TODO: probably move publishing to cherrypy.emgine failover channel here?
# TODO: probably move publishing to cherrypy.engine failover channel here?
def add_node(

View File

@ -79,7 +79,7 @@ class BaseDispatcher:
del proc
result = (True, output)
else:
logging.debug('Waiting command to finish.')
logging.debug('Waiting for command to finish.')
stdout_str, _ = proc.communicate()
returncode = proc.wait()
if stdout_str is not None:

View File

@ -64,7 +64,7 @@ class SystemdDispatcher(BaseDispatcher):
..Note:
Not working with multiple services at a time.
"""
logging.debug(f'Checking "{service}" is running.')
logging.debug(f'Checking if "{service}" is running.')
# TODO: remove conditions below when we'll drop CentOS 7 support
cmd = 'show -p ActiveState --value'
if cls.systemctl_version < 230: # not supported --value in old version