mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #21983 from jmchilton/concise_logging
More concise test logging
This commit is contained in:
@@ -5,6 +5,7 @@ Universe configuration builder.
|
||||
# absolute_import needed for tool_shed package.
|
||||
|
||||
import configparser
|
||||
import copy
|
||||
import json
|
||||
import locale
|
||||
import logging
|
||||
@@ -117,9 +118,9 @@ LOGGING_CONFIG_DEFAULT: dict[str, Any] = {
|
||||
"level": "ERROR",
|
||||
"qualname": "py.warnings",
|
||||
},
|
||||
"celery.utils.functional": {
|
||||
"celery": {
|
||||
"level": "INFO",
|
||||
"qualname": "celery.utils.functional",
|
||||
"qualname": "celery",
|
||||
},
|
||||
"sentry_sdk.errors": {
|
||||
"level": "INFO",
|
||||
@@ -162,6 +163,13 @@ DEFAULT_EMAIL_FROM_LOCAL_PART = "galaxy-no-reply"
|
||||
DISABLED_FLAG = "disabled" # Used to mark a config option as disabled
|
||||
|
||||
|
||||
def default_log_config(log_level: str = "DEBUG") -> dict[str, Any]:
|
||||
logging_conf = copy.deepcopy(LOGGING_CONFIG_DEFAULT)
|
||||
if log_level != "DEBUG":
|
||||
logging_conf["handlers"]["console"]["level"] = log_level
|
||||
return logging_conf
|
||||
|
||||
|
||||
def configure_logging(config, facts=None):
|
||||
"""Allow some basic logging configuration to be read from ini file.
|
||||
|
||||
@@ -186,9 +194,7 @@ def configure_logging(config, facts=None):
|
||||
logging_conf = config.get("logging", None)
|
||||
if logging_conf is None:
|
||||
# if using the default logging config, honor the log_level setting
|
||||
logging_conf = LOGGING_CONFIG_DEFAULT
|
||||
if config.get("log_level", "DEBUG") != "DEBUG":
|
||||
logging_conf["handlers"]["console"]["level"] = config.get("log_level", "DEBUG")
|
||||
logging_conf = default_log_config(config.get("log_level", "DEBUG"))
|
||||
# configure logging with logging dict in config, template *FileHandler handler filenames with the `filename_template` option
|
||||
for name, conf in logging_conf.get("handlers", {}).items():
|
||||
if (
|
||||
|
||||
@@ -206,7 +206,7 @@ pydantic-core==2.41.5
|
||||
pydantic-evals==1.63.0
|
||||
pydantic-graph==1.63.0
|
||||
pydantic-settings==2.13.1
|
||||
pydantic-tes==0.2.0
|
||||
pydantic-tes==0.3.0
|
||||
pydicom==3.0.1
|
||||
pydot==4.0.1
|
||||
pyeventsystem==0.1.0
|
||||
|
||||
@@ -26,8 +26,8 @@ class GenericModel(BaseModel):
|
||||
return f"{class_name}{suffix}"
|
||||
|
||||
@classmethod
|
||||
def __get_pydantic_core_schema__(cls, *args, **kwargs):
|
||||
result = super().__get_pydantic_core_schema__(*args, **kwargs)
|
||||
def __get_pydantic_core_schema__(cls, source, handler):
|
||||
result = handler(source)
|
||||
ref_to_name[result["ref"]] = cls.__name__
|
||||
return result
|
||||
|
||||
|
||||
@@ -1987,27 +1987,25 @@ class ExportObjectResultMetadata(Model):
|
||||
error: Optional[str] = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
@classmethod
|
||||
def validate_success(cls, model):
|
||||
def validate_success(self):
|
||||
"""
|
||||
Ensure successful exports do not have error text.
|
||||
"""
|
||||
if model.success and model.error is not None:
|
||||
if self.success and self.error is not None:
|
||||
raise ValueError("successful exports cannot have error text")
|
||||
|
||||
return model
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
@classmethod
|
||||
def validate_uri(cls, model):
|
||||
def validate_uri(self):
|
||||
"""
|
||||
Ensure unsuccessful exports do not have a URI.
|
||||
"""
|
||||
|
||||
if not model.success and model.uri:
|
||||
if not self.success and self.uri:
|
||||
raise ValueError("unsuccessful exports cannot have a URI")
|
||||
|
||||
return model
|
||||
return self
|
||||
|
||||
|
||||
class ExportObjectMetadata(Model):
|
||||
|
||||
@@ -21,7 +21,7 @@ from typing import (
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from galaxy.app import UniverseApplication as GalaxyUniverseApplication
|
||||
from galaxy.config import LOGGING_CONFIG_DEFAULT
|
||||
from galaxy.config import default_log_config
|
||||
from galaxy.model import mapping
|
||||
from galaxy.model.database_utils import (
|
||||
create_database,
|
||||
@@ -192,7 +192,8 @@ def setup_galaxy_config(
|
||||
data_manager_config_file = _resolve_relative_config_paths(data_manager_config_file)
|
||||
tool_config_file = _resolve_relative_config_paths(tool_conf)
|
||||
tool_data_table_config_path = _resolve_relative_config_paths(tool_data_table_config_path)
|
||||
|
||||
log_level = os.environ.get("GALAXY_TEST_LOG_LEVEL", "DEBUG").upper()
|
||||
logging = default_log_config(log_level)
|
||||
config = dict(
|
||||
admin_users="test@bx.psu.edu",
|
||||
allow_library_path_paste=True,
|
||||
@@ -232,7 +233,7 @@ def setup_galaxy_config(
|
||||
use_heartbeat=False,
|
||||
user_library_import_dir=user_library_import_dir,
|
||||
webhooks_dir=TEST_WEBHOOKS_DIR,
|
||||
logging=LOGGING_CONFIG_DEFAULT,
|
||||
logging=logging,
|
||||
monitor_thread_join_timeout=5,
|
||||
object_store_store_by="uuid",
|
||||
fetch_url_allowlist=["127.0.0.0/24"],
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
addopts = --doctest-continue-on-failure --verbosity=1 --showlocals
|
||||
asyncio_mode = auto
|
||||
log_level = DEBUG
|
||||
filterwarnings =
|
||||
ignore::DeprecationWarning:pkg_resources
|
||||
ignore::DeprecationWarning:refgenconf
|
||||
ignore::UserWarning:refgenconf
|
||||
# Install pytest-memray and set memray to true here to enable memory profiling of tests
|
||||
# memray = true
|
||||
pythonpath = lib
|
||||
|
||||
+3
-1
@@ -293,7 +293,9 @@ TOOL_SHED_TEST_TMP_DIR Defaults to random /tmp directory - place for
|
||||
tool shed test server files to be placed.
|
||||
TOOL_SHED_TEST_OMIT_GALAXY Do not launch a Galaxy server for tool shed
|
||||
testing.
|
||||
GALAXY_TEST_DISABLE_ACCESS_LOG Do not log access messages
|
||||
GALAXY_TEST_DISABLE_ACCESS_LOG Do not log access messages.
|
||||
GALAXY_TEST_LOG_LEVEL Set Galaxy server log level for tests
|
||||
(default: DEBUG). E.g. WARNING to reduce output.
|
||||
GALAXY_TEST_AXE_SCRIPT_URL URL of aXe script to use for accessibility testing.
|
||||
GALAXY_TEST_SKIP_AXE Set this to '1' to skip aXe accessibilty testing when
|
||||
running selenium tests.
|
||||
|
||||
Reference in New Issue
Block a user