jcmgray / xyzpy

Efficiently generate and analyse high dimensional data.
http://xyzpy.readthedocs.io
MIT License
66 stars 11 forks source link

RecursionError when using `allow_incomplete` option on Crop.reap #12

Open chris-n-self opened 3 years ago

chris-n-self commented 3 years ago

When I use the allow_incomplete option it sometimes fails with this error (error output shown below). I have an equal size dataset that all completed so I did not need the allow_incomplete option and that reaped fine. I tried creeping up the sys.getrecursionlimit() in the Jupyter notebook I was using and it still failed at 100,000, which is when I thought I should not push my luck any more. I am using the latest GitHub version of xyzpy.

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-6-d4907a788b7f> in <module>
----> 1 crop.reap(allow_incomplete=True,) #allow_incomplete=True,overwrite=True,

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in reap(self, wait, sync, overwrite, clean_up, allow_incomplete)
    745         if isinstance(self.farmer, Harvester):
    746             opts['overwrite'] = overwrite
--> 747             return self.reap_harvest(self.farmer, **opts)
    748 
    749         if isinstance(self.farmer, Sampler):

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in reap_harvest(self, harvester, wait, sync, overwrite, clean_up, allow_incomplete)
    685             raise ValueError("Cannot reap and harvest if no Harvester is set.")
    686 
--> 687         ds = self.reap_runner(harvester.runner, wait=wait, clean_up=clean_up,
    688                               allow_incomplete=allow_incomplete)
    689 

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in reap_runner(self, runner, wait, clean_up, allow_incomplete)
    664         # Can ignore `Runner.resources` as they play no part in desecribing the
    665         #   output, though they should be supplied to sow and thus grow.
--> 666         ds = self.reap_combos_to_ds(
    667             var_names=runner._var_names,
    668             var_dims=runner._var_dims,

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in reap_combos_to_ds(self, var_names, var_dims, var_coords, constants, attrs, parse, wait, clean_up, allow_incomplete)
    616         check_ready_to_reap(self, allow_incomplete, wait)
    617 
--> 618         clean_up, default_result = calc_clean_up_default_res(
    619             self, clean_up, allow_incomplete
    620         )

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in calc_clean_up_default_res(crop, clean_up, allow_incomplete)
    137 
    138     if allow_incomplete:
--> 139         default_result = crop.all_nan_result
    140     else:
    141         default_result = None

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in all_nan_result(self)
    422                                "one finished result.")
    423             reference_result = joblib.load(result_files[0])[0]
--> 424             self._all_nan_result = nan_like_result(reference_result)
    425 
    426         return self._all_nan_result

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in nan_like_result(res)
    124 
    125     try:
--> 126         return tuple(np.broadcast_to(np.nan, infer_shape(x)) for x in res)
    127     except TypeError:
    128         return np.nan

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in <genexpr>(.0)
    124 
    125     try:
--> 126         return tuple(np.broadcast_to(np.nan, infer_shape(x)) for x in res)
    127     except TypeError:
    128         return np.nan

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in infer_shape(x)
    102     try:
    103         shape += (len(x),)
--> 104         return shape + infer_shape(x[0])
    105     except TypeError:
    106         return shape

... last 1 frames repeated, from the frame below ...

~/anaconda3/envs/qcoptim-qiskit-up-to-date/lib/python3.8/site-packages/xyzpy/gen/batch.py in infer_shape(x)
    102     try:
    103         shape += (len(x),)
--> 104         return shape + infer_shape(x[0])
    105     except TypeError:
    106         return shape

RecursionError: maximum recursion depth exceeded while calling a Python object