Skip to content

Instantly share code, notes, and snippets.

@pprett
Created June 20, 2014 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pprett/e39a90c1710ca9dc3fd6 to your computer and use it in GitHub Desktop.
Save pprett/e39a90c1710ca9dc3fd6 to your computer and use it in GitHub Desktop.
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