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

Fix dot_seq5b reset #678

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

johnarban
Copy link
Collaborator

The PR fixes the final dangling issue from #641, forcing the distance measuring canvas to reset when we reach dot_seq5. It was just a tiny bug

@johnarban johnarban linked an issue Oct 24, 2024 that may be closed by this pull request
4 tasks
@patudom
Copy link
Contributor

patudom commented Oct 30, 2024

I'm getting the following errors (both on this branch as is, and with main merged into this branch).

To reproduce:

  • Start with a fresh student
  • Stage 1, click "select 5 random galaxies"
  • Go to Stage 3 in sequence.
  • When stepping from ang_siz5a to dot_seq5, the app crashes with these errors.
Traceback (most recent call last):
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/models.py", line 510, in prepare_body
    body = complexjson.dumps(json, allow_nan=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
ValueError: Out of range float values are not JSON compliant

During handling of the above exception, another exception occurred:

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/layout.py", line 67, in Layout
    solara.lab.use_task(
  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/layout.py", line 63, in _write_local_global_states
    LOCAL_API.put_sample_measurements(GLOBAL_STATE, LOCAL_STATE)
  File "/Users/Pat/Documents/GitHub/hubbleds/src/hubbleds/remote.py", line 212, in put_sample_measurements
    r = self.request_session.put(url, json=measurement.dict(exclude={"galaxy"}))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/sessions.py", line 649, in put
    return self.request("PUT", url, data=data, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/sessions.py", line 575, in request
    prep = self.prepare_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/sessions.py", line 484, in prepare_request
    p.prepare(
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/models.py", line 370, in prepare
    self.prepare_body(data, files, json)
  File "/Users/Pat/anaconda3/envs/common-solara/lib/python3.11/site-packages/requests/models.py", line 512, in prepare_body
    raise InvalidJSONError(ve, request=self)
requests.exceptions.InvalidJSONError: Out of range float values are not JSON compliant

@johnarban
Copy link
Collaborator Author

@patudom I have added a few commits to fix the issue with dot_seq5b. It was sending a 0 value for the measurement which resulting in an infinite value with the JSON parser did not like. 3d2be42 prevents a measurement from being made when the reset button is pressed.

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

Successfully merging this pull request may close these issues.

Stage 3 nitpicky things to fix
2 participants