Skip to content

[MRG+1] Fix tests when multiprocessing is disabled - #409

Merged
aabadie merged 3 commits into
joblib:masterfrom
lesteve:fix-tests-without-multiprocessing
Oct 5, 2016
Merged

aabadie merged 3 commits into
joblib:masterfrom
lesteve:fix-tests-without-multiprocessing

Conversation

@lesteve

@lesteve lesteve commented Oct 3, 2016

Copy link
Copy Markdown
Member

From #391 (comment):

I am observing first issue (AttributeError: 'NoneType' object has no attribute 'current_process') also while building fresh sklearn against the fresh joblib 0.10.2. To not starve build hosts I set JOBLIB_MULTIPROCESSING=0 which is just supposed to turn joblib multiprocessing off, while still performing the execution (worked e.g. with joblib 0.9.4 and before). Unfortunately logic in 0.10.2 seems to be flawed since if 0 it sets mp to None, but then without check tries to access its attributes.

I guess it would be nice if there also was a test which would set this variable to 0 and attempts perform computation(s).

@lesteve

lesteve commented Oct 3, 2016

Copy link
Copy Markdown
Member Author

@aabadie can you have a quick look at it?

@aabadie

aabadie commented Oct 3, 2016

Copy link
Copy Markdown
Contributor

LGTM +1

@aabadie aabadie changed the title [MRG] Fix tests when multiprocessing is disabled [MRG+1] Fix tests when multiprocessing is disabled Oct 3, 2016
@aabadie

aabadie commented Oct 3, 2016

Copy link
Copy Markdown
Contributor

I think @ogrisel will have a better opinion than mine on this.

@lesteve

lesteve commented Oct 3, 2016

Copy link
Copy Markdown
Member Author

From a chat IRL, @ogrisel thought it would be better to have one single Travis build that would test JOBLIB_MULTIPROCESSING=0 rather than all the builds testing both.

@lesteve

lesteve commented Oct 3, 2016

Copy link
Copy Markdown
Member Author

From a chat IRL, @ogrisel thought it would be better to have one single Travis build that would test JOBLIB_MULTIPROCESSING=0 rather than all the builds testing both.

I have just done that, @ogrisel do you want to have a look?

@aabadie aabadie left a comment

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.

Thinking of it, I just added a comment about the fix.

This also checks if we are attempting to create a nested parallel
loop.
"""
if mp is None:

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.

maybe add a comment here explaining the related problem. Something like "when multiprocessing is disabled, only one effective job is possible".
What about warning the user if n_jobs >1 and mp is None ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

mp is None can happen for mostly two reasons (joblib/_multiprocessing_helpers.py):

  • JOBLIB_MULTIPROCESSING environment variable set to 0 in which case you kind of know what you are doing so IMO a warning is superfluous.
  • locking is not available on the system (e.g. Amazon AWS Lambda IIRC) and you already get a warning here.

@lesteve lesteve added this to the 0.10.3 milestone Oct 5, 2016

@aabadie aabadie left a comment

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.

LGTM

@aabadie
aabadie merged commit 9b509de into joblib:master Oct 5, 2016
lesteve added a commit that referenced this pull request Oct 6, 2016
* Fix tests when multiprocessing is disabled

* Add a single Travis build to test JOBLIB_MULTIPROCESSING=0

* Coverage only needed once
@lesteve
lesteve deleted the fix-tests-without-multiprocessing branch October 18, 2016 09:26
yarikoptic added a commit to yarikoptic/joblib that referenced this pull request Dec 8, 2016
* tag '0.10.3':
  MAINT simplify setup.py
  Bump up version for 0.10.3 release
  Add entries for 0.10.3 release in CHANGES.rst
  [MRG+1] Fix tests when multiprocessing is disabled (joblib#409)
  [MRG+1] Remove warnings in nested Parallel when the inner Parallel has n_jobs=1 (joblib#406)
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