Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fix logging in adni to bids #1181

Merged

Conversation

NicolasGensollen
Copy link
Member

The function create_file in the adni-to-bids converter is executed in a multiprocessing context but doesn't handle the logging of messages in the sense that child processes do not configure their own logger.

This has a few consequences like the fact that messages logged from child processes aren't formatted or might even be missing.

This PR proposes a quick fix of re-configuring the clinica logger in child processes.

Ideally, we should have a process-safe logging architecture which would avoid race conditions (especially when logging to files for instance).
A classical solution is to dedicate a process to the logging task while other working processes send their logging messages through a Queue.

Copy link
Contributor

@AliceJoubert AliceJoubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @NicolasGensollen !!
Messages of all levels from these files now appear properly in the terminal. That also means we get even more info messages than before and we might want to get rid of some of them later

clinica/iotools/converters/adni_to_bids/adni_utils.py Outdated Show resolved Hide resolved
@NicolasGensollen NicolasGensollen marked this pull request as ready for review May 17, 2024 08:52
@NicolasGensollen NicolasGensollen merged commit 7f7a0b4 into aramis-lab:dev May 17, 2024
14 of 16 checks passed
@NicolasGensollen NicolasGensollen deleted the fix-logging-in-adni-to-bids branch May 17, 2024 08:54
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.

2 participants