Created
June 20, 2014 16:00
-
-
Save pprett/e39a90c1710ca9dc3fd6 to your computer and use it in GitHub Desktop.
joblib hangs if job segfaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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