cosmicds / hubbleds

Hubble's law data story
MIT License
0 stars 8 forks source link

Use "minimal" version of data from other students/classes #608

Closed Carifio24 closed 1 week ago

Carifio24 commented 3 weeks ago

This updates stage 5 to take advantage of the ability to query the more lightweight "minimal" version from the /all-data endpoint introduced in https://github.com/cosmicds/cds-api/pull/134.

patudom commented 2 weeks ago

I just tried running this PR and am getting a bunch of errors in Stage 4.

What I did and observed:

Traceback (most recent call last):
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1707, in _render
    root_element = el.component.f(*el.args, **el.kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 80, in Page
    solara.lab.use_task(_load_student_data)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 846, in use_task
    return wrapper(f)
           ^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 840, in wrapper
    raise task_instance.exception
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 259, in runner
    self._last_value = value = await self.function(*args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 78, in _load_student_data
    measurements = LOCAL_API.get_measurements(GLOBAL_STATE, LOCAL_STATE)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/remote.py", line 111, in get_measurements
    measurements.set(parsed_measurements)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 571, in set
    self._field.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 645, in set
    self._parent.set(parent_value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 620, in set
    self._parent.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 358, in set
    self._storage.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 266, in set
    self.fire(value, old)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 148, in fire
    with contextlib.ExitStack() as stack:
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 601, in __exit__
    raise exc_details[1]
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 586, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1194, in __exit__
    self._possible_rerender()
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1391, in _possible_rerender
    self.render(self.element, self.container)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1463, in render
    raise RuntimeError(msg)
RuntimeError: Too many renders triggered, your render loop does not stop
Last reason: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 61 to 62

Previous reasons: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 60 to 61
patudom commented 2 weeks ago

Actually, I'm getting similar errors on PR 609 which should be completely unrelated, so now I'm not sure if there's just something wonky with my setup.

As @johnarban noticed and fixed in #604, we never turned back on updating the db when we migrated back content from the demo version. Since that branch wasn't merged yet, I added a small commit to this branch to fix the problem here. Is there anything else I'm missing?

Traceback (most recent call last):
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1707, in _render
    root_element = el.component.f(*el.args, **el.kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 80, in Page
    solara.lab.use_task(_load_student_data)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 846, in use_task
    return wrapper(f)
           ^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 840, in wrapper
    raise task_instance.exception
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/tasks.py", line 259, in runner
    self._last_value = value = await self.function(*args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/pages/04-explore-data/__init__.py", line 78, in _load_student_data
    measurements = LOCAL_API.get_measurements(GLOBAL_STATE, LOCAL_STATE)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/remote.py", line 111, in get_measurements
    measurements.set(parsed_measurements)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 571, in set
    self._field.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 645, in set
    self._parent.set(parent_value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 620, in set
    self._parent.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 358, in set
    self._storage.set(value)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 266, in set
    self.fire(value, old)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/solara/toestand.py", line 148, in fire
    with contextlib.ExitStack() as stack:
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 601, in __exit__
    raise exc_details[1]
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/contextlib.py", line 586, in __exit__
    if cb(*exc_details):
       ^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1194, in __exit__
    self._possible_rerender()
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1391, in _possible_rerender
    self.render(self.element, self.container)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/reacton/core.py", line 1463, in render
    raise RuntimeError(msg)
RuntimeError: Too many renders triggered, your render loop does not stop
Last reason: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 58 to 59

Previous reasons: Reason: state changed with key auto_subscribe_force_update_counter
Value changed from 57 to 58
patudom commented 1 week ago

With the fix in https://github.com/cosmicds/cosmicds/pull/337, this is now working well. Thank you!