parallel.futures:“在将来运行或挂起时,进程池中的进程突然终止。”

时间:2018-10-24 23:59:11

标签: python python-3.x multiprocessing

使用Python 3.6 <?php session_start(); if (!isset($_Session['county'])) { $_SESSION['county'] = array(); } if (!isset($_Session['state'])) { $_SESSION['state'] = array(); } if (!isset($_Session['householdNumber'])) { $_SESSION['householdNumber'] = array(); } if (!isset($_Session['householdIncome'])) { $_SESSION['householdIncome'] = array(); } $dtmDateOfSurvey = $_POST["dtmDateOfSurvey"]; $strCountyAndState = $_POST["strCountyAndState"]; $intNumberInHousehold = $_POST["intNumberInHousehold"]; $dblHouseholdYearlyIncome = $_POST["dblHouseholdYearlyIncome"]; $arrCountyState = explode(',', $strCountyAndState); $strCounty = $arrCountyState[0]; $strState = $arrCountyState[1]; array_push($_SESSION['county'],$strCounty); array_push($_SESSION['state'],$strState); array_push($_SESSION['householdNumber'],$intNumberInHousehold); array_push($_SESSION['householdIncome'],$dblHouseholdYearlyIncome); header('Location: index.html'); ?> 软件包时,我在某些进程错误上似乎是随机出现这些错误:

concurrent

我的调度代码如下:

Thread generated an exception: A process in the process pool was terminated abruptly while the future was running or pending.

我的工作人员代码是:

ks_par = []
with concurrent.futures.ProcessPoolExecutor(max_workers=pool_size) as executor:
    future_histogram = {executor.submit(process_event_thread, fname, ix, indices[ix], bn_arr): ix for ix in range(index, index + min(pool_size, remaining_events))}
    for future in concurrent.futures.as_completed(future_histogram):
        try:
            data = future.result()
        except Exception as exc:
            print('Thread generated an exception: %s' % (exc))
        else:
            ks_par.append(data)

def process_event_thread(fname, ix, i_idx, bn_arr): with h5py.File(fname,'r') as f: f_idx = f['idx_tr'][ix] hit_pos = f['coord'][0,i_idx:f_idx,:] means = f['coord'][1,i_idx:f_idx,:] sigmas = f['sigma'][i_idx:f_idx] r_lens = f['r_lens'][()] n_ph = f_idx - i_idx i_idx = f_idx try: tr_dist, er_dist = ia.new_track_dist(hit_pos, means, sigmas, False, r_lens) except Exception as ex: logger.info('Thread generated an exception: %s' % (ex)) err_dist = 1./np.asarray(er_dist) hist = ia.make_hist(bn_arr, tr_dist, err_dist) return hist 和支持模块中有许多方法,因此将所有方法都发布是不切实际的。简短的测试用例也不会失败。)

我该如何调试呢?

0 个答案:

没有答案