Skip to content

[WIP] Disables the loky backend for environments where sem_open implementation is not available#999

Open
jrgriffiniii wants to merge 1 commit intojoblib:mainfrom
jrgriffiniii:issues-825-jrgriffiniii-no-sem-support
Open

[WIP] Disables the loky backend for environments where sem_open implementation is not available#999
jrgriffiniii wants to merge 1 commit intojoblib:mainfrom
jrgriffiniii:issues-825-jrgriffiniii-no-sem-support

Conversation

@jrgriffiniii
Copy link
Copy Markdown

Resolves #825, but I need to add an alternative wrap_non_picklable_objects implementation and change the error logging a bit.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 26, 2020

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.32%. Comparing base (f2fa60f) to head (8aa38c5).
⚠️ Report is 282 commits behind head on main.

Files with missing lines Patch % Lines
joblib/parallel.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #999      +/-   ##
==========================================
+ Coverage   92.26%   95.32%   +3.05%     
==========================================
  Files          45       45              
  Lines        6645     6648       +3     
==========================================
+ Hits         6131     6337     +206     
+ Misses        514      311     -203     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

from multiprocessing import synchronize
synchronize.SemLock._make_name = staticmethod(_make_name)
except ImportError as import_error:
# sys.stderr.write(f"Disabling loky support: {import_error}")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm not certain how this should be handled. Where is it best to log this error?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this needed if joblib/parallel.py already uses a try / except ImportError on from .externals import loky?

@jrgriffiniii
Copy link
Copy Markdown
Author

I'm waiting for the tests to pass before I rebase this.

@jrgriffiniii
Copy link
Copy Markdown
Author

https://travis-ci.org/joblib/joblib/jobs/642093480?utm_medium=notification&utm_source=github_status is failing with the following error:

E   ModuleNotFoundError: No module named 'sklearn.decomposition.dict_learning'

I am not certain as to what is triggering this, but the only other test which was failing was a flake8 issue I resolved. The other tests in the build pass:
https://travis-ci.org/joblib/joblib/builds/642093478?utm_medium=notification&utm_source=github_status

have a functioning sem_open implementation; Moving cloudpickle_wrapper
(this is not dependent upon loky)
@jrgriffiniii jrgriffiniii force-pushed the issues-825-jrgriffiniii-no-sem-support branch from 6a49f2b to 8aa38c5 Compare January 26, 2020 19:43
@jrgriffiniii jrgriffiniii changed the title [WIP] Disables the loky backend for environments where sem_open implementation is not available Disables the loky backend for environments where sem_open implementation is not available Jan 26, 2020
@jrgriffiniii jrgriffiniii requested a review from ogrisel January 26, 2020 19:47
@thebestnom
Copy link
Copy Markdown

Do you mind adding a test future releases would not break this?

@jrgriffiniii jrgriffiniii changed the title Disables the loky backend for environments where sem_open implementation is not available [WIP] Disables the loky backend for environments where sem_open implementation is not available Jan 26, 2020
Copy link
Copy Markdown
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

I am fine defaulting to the threading backend on platforms that do not support sem_open but here are some comments:


from .externals.loky import wrap_non_picklable_objects

from .externals.cloudpickle_wrapper import wrap_non_picklable_objects
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is problematic. The loky vendoring script will not work anymore and users would expect loky consistency will be lose.

I would rather wrap this with a try / except ImportError and not export the wrap_non_picklable_objects in __all__ when loky cannot be imported. Add a comment to explain that this can happen on systems that do not support sem_open (e.g. Android).

from multiprocessing import synchronize
synchronize.SemLock._make_name = staticmethod(_make_name)
except ImportError as import_error:
# sys.stderr.write(f"Disabling loky support: {import_error}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this needed if joblib/parallel.py already uses a try / except ImportError on from .externals import loky?

@thebestnom
Copy link
Copy Markdown

Any news on this?

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.

Fall back to serial mode does not work in current version

3 participants