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 issue with running buildtest with multiprocessing library #1522

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

shahzebsiddiqui
Copy link
Member

we were seeing issue with running buildtest build command on mac with some error message like this

│ /usr/local/Cellar/[email protected]/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/m │
│ ultiprocessing/spawn.py:134 in _check_not_importing_main                                         │
│                                                                                                  │
│   131                                                                                            │
│   132 def _check_not_importing_main():                                                           │
│   133 │   if getattr(process.current_process(), '_inheriting', False):                           │
│ ❱ 134 │   │   raise RuntimeError('''                                                             │
│   135 │   │   An attempt has been made to start a new process before the                         │
│   136 │   │   current process has finished its bootstrapping phase.                              │
│   137                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

This was because the entry point to buildtest command wasnt invoked in if __name__. This was discovered according to https://superfastpython.com/multiprocessing-spawn-runtimeerror/. Note that if one runs python buildtest/main.py build -t pass it should work without this change. With this change it should work both ways.

if __name__ == "__main__".

This caused an issue with running buildtest with multiprocessing library
@shahzebsiddiqui shahzebsiddiqui merged commit 6b60fe5 into devel Jul 6, 2023
16 checks passed
@shahzebsiddiqui shahzebsiddiqui deleted the fix_multiprocessing_issue branch July 6, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant