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

Run method fix #300

Merged
merged 5 commits into from Mar 30, 2021
Merged

Run method fix #300

merged 5 commits into from Mar 30, 2021

Conversation

zStupan
Copy link
Contributor

@zStupan zStupan commented Mar 30, 2021

  • Fixed run method to prevent deadlock when running in separate thread and an exception is thrown. Discussed in Deprecation warnings #297

The run method now catches the exception and stores it in self.exception. The method bad_run can then be used to check if an exception has occured in the running of the algorithm.

@zStupan
Copy link
Contributor Author

zStupan commented Mar 30, 2021

Should I add in a check, if the current thread is the main thread to just raise the exception?

@firefly-cpp
Copy link
Contributor

Great!

Yes. You can check the current thread.

@zStupan
Copy link
Contributor Author

zStupan commented Mar 30, 2021

Hmm this is strange
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\users\runneradmin\.virtualenvs\niapy-ki639xhk\lib\site-packages

EDIT:
OK, it looks like it'll go through now.
I added a "private" function _is_main_process_or_thread() to algorithm.py which check if current process/thread is the main process/thread. It works with both python 2 and 3

@firefly-cpp
Copy link
Contributor

firefly-cpp commented Mar 30, 2021

Nice. Thank you @zStupan for all your hard work!

@firefly-cpp firefly-cpp merged commit b125e4d into NiaOrg:master Mar 30, 2021
@zStupan zStupan deleted the fix_run branch March 30, 2021 11:55
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.

None yet

2 participants