question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent joblib.Parallel behaviour between v0.12 and v0.14 when running from within an imported module?

See original GitHub issue

I have a joblib.Parallel statement which is run from within an imported module. From v0.12 to v0.12.5 it works nicely, but with v0.13+ it goes serial with no errors.

The schema of my code (which spans several files) follows. Input arguments are omitted for the sake of readability.

# main file
import f1
for _ in range(n):
    f1()

# file containing f1
import f2
def f1():
    # do something with f2
    return something

# file containing f2
def f2():
    def help():
        return something
    joblib.Parallel(delayed(help))    # parallel with loki backend
    return something

I tried to find some information online regarding joblib.Parallel and its use on nested functions, with no luck.

However, if I change my workflow as follows

# main file
import f1
joblib.Parallel(delayed(f1))     # parallel with loki backend

# file containing f1
import f2
def f1():
    # do something with f2
    return something

# file containing f2
def f2():
    def help():
        return something
    for _ in range():
        # run help() in serial with a plain for loop
    return something

everything starts working also with v0.14.

What am I missing? And why with joblib v0.12-0.12.5 it works fine but with joblib v0.13+ it goes serial?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Alessi0Xcommented, May 15, 2020

@ogrisel

Going serial when it should not is what I called being a bug.

Sorry, since you were mentioning errors or tracebacks I thought you meant bugs as errors/crashes.

I will try my best to provide a minimal working example.

1reaction
Alessi0Xcommented, May 13, 2020

Hi @pierreglaser I have updated my code snippet with info on joblib’s backends.

I will try to craft a minimal working example, but this ain’t going to be easy. Unfortunately, things are quite nested here. I’ll try to work it out anyway

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot use imported modules with joblib #13632 - GitHub
Run joblib with an imported local function. This will generate an error "ModuleNotFoundError: No module named 'MyOwnModule' ending up with ...
Read more >
Your First Machine Learning Project in Python Step-By-Step
In this step we are going to load the iris data from CSV file URL. 2.1 Import libraries. First, let's import all of...
Read more >
Changelog — sktime documentation
We keep track of changes in this file since v0.4.0. ... This was inconsistent previously between types of transformers: the series-to-series ...
Read more >
Release 0.21.3 unknown - Pyodide
Pyodide makes it possible to install and run Python packages in the ... using the js module (see Importing JavaScript objects into Python)....
Read more >
Introduction to Python for Econometrics, Statistics and Data ...
14 Dates and Times ... 28.6 Other Concerns when executing in Parallel . ... programs due to backward incompatible changes in a module....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found