Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/launchpad/size/analyzers/apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def analyze(self, artifact: AppleArtifact) -> AppleAnalysisResults:
extract_dir=artifact.get_extract_dir(),
)
if workers > 0:
logger.debug(f"Analyzing binaries with {workers} processes")
logger.info("size.apple.binary_analysis_workers", extra={"workers": workers})
executor = ProcessPoolExecutor(
max_workers=workers,
initializer=_binary_worker_init,
Expand Down
9 changes: 8 additions & 1 deletion tests/integration/size/test_apple_app_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,17 @@ def test_parallel_binary_analysis_matches_in_process(self, hackernews_xcarchive:
assert in_process.treemap.model_dump_json() == parallel.treemap.model_dump_json()

def test_worker_logs_reach_stdout_with_request_id(
self, hackernews_xcarchive: Path, monkeypatch: pytest.MonkeyPatch, capfd: pytest.CaptureFixture[str]
self,
hackernews_xcarchive: Path,
monkeypatch: pytest.MonkeyPatch,
capfd: pytest.CaptureFixture[str],
caplog: pytest.LogCaptureFixture,
) -> None:
"""Uses spawn rather than forkserver: the forkserver inherits stdout once at startup,
before capfd redirects it, so forkserver workers would write past the capture."""
ctx = mp.get_context("spawn")
monkeypatch.setattr(apple, "ProcessPoolExecutor", functools.partial(ProcessPoolExecutor, mp_context=ctx))
caplog.set_level(logging.INFO, logger=apple.logger.name)

with request_context():
request_id = current_request_id()
Expand All @@ -208,6 +213,8 @@ def test_worker_logs_reach_stdout_with_request_id(
assert completed
assert all(d["request_id"] == request_id for d in completed)
assert all(isinstance(d["elapsed_s"], float) for d in completed)
pool = [r for r in caplog.records if r.getMessage() == "size.apple.binary_analysis_workers"]
assert [r.workers for r in pool] == [2]

def test_worker_logging_applies_third_party_suppression(self, capfd: pytest.CaptureFixture[str]) -> None:
ctx = mp.get_context("spawn")
Expand Down
Loading