Skip to content

Conversation

dmasad
Copy link
Member

@dmasad dmasad commented Oct 27, 2014

Implementing a simple server which displays TextVisualization ascii visualizations in-browser, with 'Step' and 'Reset' buttons. Demonstrates how to template a page based on a visualization, and then populate it with step-by-step data generated from a model object.
Resolves Issue #26 (now with issue #33 fixed as well)

Refs #1: Adding license to the project.
A very simple ASCII server that renders the text visualization in the
browser.
Added a real websocket protocol, fixed the ugly template path hack, and
implemented resetting.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give an actual example please. "data": some text unparseable by actual json is unhelpful for building APIs

@kfuruya
Copy link
Contributor

kfuruya commented Oct 30, 2014

So I was testing and ran into this crash:

Socket opened!
WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 0.55ms
{"type":"get_step","step":0}
{"type":"get_step","step":1}
{"type":"get_step","step":2}
...
{"type":"get_step","step":9}
{"type":"get_step","step":10}
{"type":"reset"}
('Model steps:', 26)
{"type":"get_step","step":1}
{"type":"get_step","step":2}
...
{"type":"get_step","step":26}
{"type":"get_step","step":27}
ERROR:tornado.application:Uncaught exception in /ws
Traceback (most recent call last):
  File "/Users/kfuruya/.virtualenvs/mesa/lib/python2.7/site-packages/tornado/websocket.py", line 369, in _run_callback
    callback(*args, **kwargs)
  File "/Users/kfuruya/mesa/mesa/visualization/TextServer.py", line 113, in on_message
    return_message["data"] = self.controller.viz_states[step]
IndexError: list index out of range

I'm going to look into this, but it seems like it crashed well within the realm of expected use

Cleaning up some of the code following @kfuruya review.
@dmasad
Copy link
Member Author

dmasad commented Oct 30, 2014

Yep, should be an easy error to fix. Opened Issue #33 to deal with it.

Fixing issue #33, bug which caused the server to crash when an
out-of-range step was requested.
@dmasad dmasad added this to the MVP Awesome milestone Nov 1, 2014
Adding a play button, which runs the model at the set frame rate until
it hits the end.
@dmasad dmasad force-pushed the python3_compatibility branch 2 times, most recently from d90756c to 9ad9cc7 Compare November 4, 2014 19:26
@dmasad dmasad closed this Nov 4, 2014
EwoutH pushed a commit that referenced this pull request Oct 12, 2024
* fix bug where agent gives money to itself in the boltzmann model example
* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Houssam Kherraz <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
EwoutH pushed a commit that referenced this pull request Oct 12, 2024
* fix bug where agent gives money to itself in the boltzmann model example
* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Houssam Kherraz <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
EwoutH pushed a commit to EwoutH/mesa that referenced this pull request Oct 15, 2024
* fix bug where agent gives money to itself in the boltzmann model example
* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Houssam Kherraz <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

2 participants