Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverse_property_cascade sometimes returns IndexError instead of NoResultsError #46

Closed
ARRicarte opened this issue Apr 2, 2018 · 4 comments

Comments

@ARRicarte
Copy link

ARRicarte commented Apr 2, 2018

Hi Andrew,

I found that when querying for many different properties, reverse_property_cascade will sometimes give me an IndexError instead of a NoResultsError if the property with no results is followed by other properties. Below I've copy-pasted the error message starting from lines relevant to you.

Thanks,
Angelo

  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/core/halo.py", line 331, in reverse_property_cascade
    return self.calculate_for_progenitors(*args, **kwargs)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/core/halo.py", line 327, in calculate_for_progenitors
    return self.calculate_for_descendants(*plist, **kwargs)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/core/halo.py", line 316, in calculate_for_descendants
    return property_description.values_sanitized(results, Session.object_session(self))
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/live_calculation/__init__.py", line 160, in values_sanitized
    unsanitized_values = self.values(halos)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/live_calculation/__init__.py", line 138, in values
    values, _ = self.values_and_description(halos)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/live_calculation/__init__.py", line 295, in values_and_description
    values, description = c.values_and_description(mask.mask(halos))
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/live_calculation/__init__.py", line 677, in values_and_description
    description_class = properties.providing_class(self._name, sim.output_handler_class, silent_fail=True)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/util/consistent_collection.py", line 17, in __getattr__
    return self._ensure_consistent(values, item)
  File "/home/fas/natarajan/arr56/.local/lib/python2.7/site-packages/tangos/util/consistent_collection.py", line 26, in _ensure_consistent
    return values[0]
IndexError: list index out of range
@apontzen
Copy link
Member

apontzen commented Apr 4, 2018

Thanks, I’ll look into it!

@apontzen
Copy link
Member

Unfortunately I've not been able to reproduce this issue. Could you give an example e.g. using the tutorial database?

@apontzen
Copy link
Member

Actually after a bit more playing, I was able to reproduce the issue and have pushed a fix to #72 (branch issue-46) — could you check whether this solves the issue for you?

@apontzen
Copy link
Member

I'm closing this issue on the assumption it is fixed. Please re-open if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants