Skip to content

Commit

Permalink
Update joblib to 0.10.3 version (scikit-learn#7696)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve authored Oct 20, 2016
1 parent 2caa144 commit 82a6740
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion sklearn/externals/joblib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = '0.10.2'

__version__ = '0.10.3'


from .memory import Memory, MemorizedResult
Expand Down
12 changes: 8 additions & 4 deletions sklearn/externals/joblib/_parallel_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,16 @@ def effective_n_jobs(self, n_jobs):
This also checks if we are attempting to create a nested parallel
loop.
"""
if mp is None:
return 1

if mp.current_process().daemon:
# Daemonic processes cannot have children
warnings.warn(
'Multiprocessing-backed parallel loops cannot be nested,'
' setting n_jobs=1',
stacklevel=3)
if n_jobs != 1:
warnings.warn(
'Multiprocessing-backed parallel loops cannot be nested,'
' setting n_jobs=1',
stacklevel=3)
return 1

elif threading.current_thread().name != 'MainThread':
Expand Down
14 changes: 11 additions & 3 deletions sklearn/externals/joblib/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ def assert_raises_regex(expected_exception, expected_regexp,
expected_exception(expected_regexp))


def check_subprocess_call(cmd, timeout=1, stdout_regex=None):
def check_subprocess_call(cmd, timeout=1, stdout_regex=None,
stderr_regex=None):
"""Runs a command in a subprocess with timeout in seconds.
Also checks returncode is zero and stdout if stdout_regex is set.
Also checks returncode is zero, stdout if stdout_regex is set, and
stderr if stderr_regex is set.
"""
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
Expand All @@ -79,7 +81,13 @@ def kill_process():
if (stdout_regex is not None and
not re.search(stdout_regex, stdout)):
raise ValueError(
"Unexpected output: '{0!r}' does not match:\n{1!r}".format(
"Unexpected stdout: {0!r} does not match:\n{1!r}".format(
stdout_regex, stdout))
if (stderr_regex is not None and
not re.search(stderr_regex, stderr)):
raise ValueError(
"Unexpected stderr: {0!r} does not match:\n{1!r}".format(
stderr_regex, stderr))

finally:
timer.cancel()

0 comments on commit 82a6740

Please sign in to comment.