Skip to content

Commit 2df2242

Browse files
fix: clean up verbose integration logging
1 parent b7d051c commit 2df2242

4 files changed

Lines changed: 28 additions & 4 deletions

File tree

plexe/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ def setup_logging(config: Config) -> logging.Logger:
562562
# Get package root logger
563563
package_logger = logging.getLogger("plexe")
564564
package_logger.setLevel(getattr(logging, config.log_level.upper()))
565+
# Avoid duplicate output when external handlers (e.g., pytest live logging)
566+
# are attached to the root logger.
567+
package_logger.propagate = False
565568

566569
# Clear existing handlers to avoid duplicates
567570
package_logger.handlers = []

plexe/execution/dataproc/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ def _create_local_spark(config) -> SparkSession:
109109
logger.info("Using pre-bundled Spark JARs from /opt/spark-jars/")
110110
builder = builder.config("spark.jars", spark_jars_env)
111111
else:
112-
# Fallback: Download JARs at runtime via Maven (local development)
113-
logger.info("Downloading Spark JARs from Maven Central (first run may take ~40s)")
112+
# Fallback: Resolve JARs via Maven (download occurs only on cache miss)
113+
logger.info("Resolving Spark JARs via Maven Central (download only on first run/cache miss)")
114114
builder = builder.config(
115115
"spark.jars.packages",
116116
"org.apache.hadoop:hadoop-aws:3.3.6,com.amazonaws:aws-java-sdk-bundle:1.12.367",

scripts/tests/run_integration_staged.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,24 @@ else
2828
WORKERS="auto"
2929
fi
3030
PYTEST_PARALLEL_ARGS=(-n "$WORKERS")
31+
PYTEST_LOG_DISABLE_ARGS=(
32+
--log-disable=LiteLLM
33+
--log-disable=litellm
34+
--log-disable=httpx
35+
--log-disable=httpcore
36+
--log-disable=urllib3
37+
--log-disable=py4j
38+
--log-disable=py4j.clientserver
39+
--log-disable=py4j.java_gateway
40+
)
3141

3242
run_stage() {
3343
local stage_name="$1"
3444
local marker="$2"
3545
local cmd=(poetry run pytest tests/integration -m "$marker" "${PYTEST_PARALLEL_ARGS[@]}" --maxfail=1)
3646

3747
if [[ "${PLEXE_IT_VERBOSE:-0}" == "1" ]]; then
38-
cmd+=(-s -vv -o log_cli=true -o log_cli_level=INFO --capture=tee-sys)
48+
cmd+=(-s -vv -o log_cli=true -o log_cli_level=INFO --capture=tee-sys "${PYTEST_LOG_DISABLE_ARGS[@]}")
3949
fi
4050

4151
PLEXE_IT_STAGE="$stage_name" "${cmd[@]}"

tests/unit/test_config.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Unit tests for config helpers."""
22

3+
import logging
4+
35
import pytest
46
import yaml
57

6-
from plexe.config import Config, RoutingConfig, RoutingProviderConfig, get_routing_for_model
8+
from plexe.config import Config, RoutingConfig, RoutingProviderConfig, get_routing_for_model, setup_logging
79

810

911
def test_get_routing_for_model_mapping_and_default():
@@ -72,3 +74,12 @@ def test_get_temperature_resolves_override_and_default():
7274

7375
assert config.get_temperature("hypothesiser") == pytest.approx(0.7)
7476
assert config.get_temperature("layout_detector") == pytest.approx(0.2)
77+
78+
79+
def test_setup_logging_disables_propagation():
80+
"""Plexe logger should not propagate to root to avoid duplicate log lines."""
81+
logger = setup_logging(Config(log_level="INFO"))
82+
83+
assert logger.name == "plexe"
84+
assert logger.propagate is False
85+
assert any(isinstance(h, logging.StreamHandler) for h in logger.handlers)

0 commit comments

Comments
 (0)