Skip to content

Isolate per-run logging from the process root logger - #499

Open
HarshRajSinghania wants to merge 2 commits into
algorithmicsuperintelligence:mainfrom
HarshRajSinghania:fix/isolate-per-run-logging
Open

HarshRajSinghania wants to merge 2 commits into
algorithmicsuperintelligence:mainfrom
HarshRajSinghania:fix/isolate-per-run-logging

Conversation

@HarshRajSinghania

Copy link
Copy Markdown

Summary

Attach OpenEvolve log handlers to the openevolve package logger instead of the process root logger, and give each controller instance its own filtered handlers.

Motivation

Fixes #295. Parallel OpenEvolve runs in the same process were registering file and console handlers on the root logger, so each run duplicated the others' logs. Maintainer note on the issue: we should not take the global namespace.

Implementation

  • _setup_logging now configures logging.getLogger("openevolve") with propagate=False.
  • Each instance gets a short run id, its own file/console handlers, and a contextvars-based filter so concurrent tasks do not write to each other's handlers.
  • Handlers are removed in _teardown_logging from the run() finally block.
  • Log filenames include the run id.

Testing

export OPENAI_API_KEY=test-key-for-unit-tests
PYTHONPATH=. python -m unittest tests.test_logging_isolation -v

Result: 3 tests OK.

Note: worker processes still configure logging independently; this change targets same-process concurrent controllers, which is what #295 describes.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ Harsh Raj Singhania
❌ HarshRajSinghania


Harsh Raj Singhania seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Openevolve run calls in parallel result in clobbered loggers

2 participants