Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
joblib hangs if job segfaults
import numpy as np
from sklearn.ensemble import gradient_boosting
import time
from joblib import Parallel, delayed
class Bad(object):
tree_ = None
def fit_one(i):
if i == 3:
# this will segfault
bad = np.array([[Bad()] * 2], dtype=np.object)
gradient_boosting.predict_stages(bad,
np.random.rand(20, 2).astype(np.float32),
1.0, np.random.rand(20, 2))
else:
time.sleep(1)
return i
out = Parallel(n_jobs=4)(delayed(fit_one)(i) for i in range(10))
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment