[desc] Import CREATE_NEW_PROCESS_GROUP flag from subprocess#2719
Merged
fabiencastan merged 1 commit intodevelopfrom May 5, 2025
Merged
[desc] Import CREATE_NEW_PROCESS_GROUP flag from subprocess#2719fabiencastan merged 1 commit intodevelopfrom
CREATE_NEW_PROCESS_GROUP flag from subprocess#2719fabiencastan merged 1 commit intodevelopfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a Windows-specific issue by replacing the use of psutil's nonexistent creation flag with subprocess's CREATE_NEW_PROCESS_GROUP flag to ensure that spawned subprocesses can be properly terminated.
- Import the correct flag from subprocess
- Update the process creation arguments in the Windows branch
Comments suppressed due to low confidence (2)
meshroom/core/desc/node.py:4
- [nitpick] The flag is now correctly imported from subprocess; please verify if psutil is still needed elsewhere in this file to avoid any unnecessary imports.
from subprocess import CREATE_NEW_PROCESS_GROUP
meshroom/core/desc/node.py:159
- The change properly resolves the issue on Windows; please ensure through testing that this change does not inadvertently affect process group management on other platforms.
platformArgs = {"creationflags": CREATE_NEW_PROCESS_GROUP}
`psutil` does not contain these creation flags but supports `subprocess`'s, so the one from `subprocess` needs to be used in order for the process to be created properly.
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## develop #2719 +/- ##
===========================================
- Coverage 76.75% 76.74% -0.01%
===========================================
Files 40 40
Lines 6082 6084 +2
===========================================
+ Hits 4668 4669 +1
- Misses 1414 1415 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fabiencastan
approved these changes
May 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an issue that occurs only on Windows when executing nodes, following #2703.
The
CREATE_NEW_PROCESS_GROUPflag must be added to the list of creation flags when doing thePopento ensure that the process to execute will not be fully detached (and hence will be killable). However,psutildoes not contain any creation flags, instead supporting those fromsubprocess(https://psutil.readthedocs.io/en/stable/#psutil.Popen).Prior to this PR, attempting to use
psutil.CREATE_NEW_PROCESS_GROUPwould cause an error on the execution for all the node processes as it did not exist. This PR replaces it bysubprocess.CREATE_NEW_PROCESS_GROUP, effectively creating the process with the correct status. It is worth noting thatsubprocess.CREATE_NEW_PROCESS_GROUPis imported within theif sys.platform == "win32"condition as this flag only exists for Windows platforms.