Skip to content

joblib.Parallel silently fails to re-raise exception when n_jobs > 1 and n_iterations > n_jobs*2 #1489

@arkanoid87

Description

@arkanoid87

switch BAD_CASE with GOOD_CASE in iterate_me call

from joblib import Parallel, delayed

def iterate_me(n):
    for i in range(n):
        assert i != n-1
        yield n

def identity(x):
    return x

N_JOBS = 2
GOOD_CASE = N_JOBS * 2
BAD_CASE = GOOD_CASE + 1

try:
    Parallel(n_jobs=N_JOBS)(delayed(identity)(i) for i in iterate_me(BAD_CASE))
    print("BAD - this line should never be reached")
except Exception:
    print("GOOD - this line should always be reached")

current result

BAD - this line should never be reached

expected result

GOOD - this line should always be reached

version

Python 3.11.3
joblib==1.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions