3drobotics / solodevguide

Solo Development Guide (SDG).
http://dev.3dr.com/
41 stars 62 forks source link

examples/webserver: remove use of greenlets #290

Closed peterbarker closed 8 years ago

peterbarker commented 8 years ago

Fixes #287

hamishwillee commented 8 years ago

Hi @peterbarker

  1. This seems to remove "eventlet" not "greenlet" as per the title
  2. I still see this error in the log when installing to Solo: cp: can't stat '/usr/lib/python2.7/site-packages/greenlet*': No such file or directory
  3. Running this on Solo gives me this error:
D:\Github\solodevguide\examples\webserver>solo script run server.py
connecting to solo...
checking pip...
uploading script bundle...
./
./requirements.txt
./server.py
./static/
./static/jquery.min.js
./static/socket.io.min.js
./templates/
./templates/index.html
Not deleting env/bin
New python executable in env/bin/python
Installing setuptools, pip, wheel...done.
cp: can't stat '/usr/lib/python2.7/site-packages/greenlet*': No such file or directory
Ignoring indexes: https://pypi.python.org/simple
Requirement './wheelhouse/*.whl' looks like a filename, but the file does not exist
*.whl is not a valid wheel filename.
running script...

Traceback (most recent call last):
  File "/log/solo-script/server.py", line 1, in <module>
    from flask import Flask, render_template
ImportError: No module named flask
  1. Also need to update /book/example-webserver.md to remove the mention of eventlet.

Does this have any other "implications"? Ie why was greenlets used in the first place?

peterbarker commented 8 years ago

greenlets were backing the eventlets.

The "cp" of the greenlet files should go away once we verify no other example is using it. Or possibly juts right now.

Your "pack" appears to be missing every wheel, not just flask. Can you present the listing of files in solo-sript.tar.gz, please?

I do not know why someone went to the trouble of using greenlets - the "cp" hack shows it was not a natural thing to do. They will probably have better performance than standard threading, but they do have the disadvantage of... not working on Solo ATM.

hamishwillee commented 8 years ago

I've sent you the tar. You're right - wheels are missing.

hamishwillee commented 8 years ago

The tar issue fixed by https://github.com/3drobotics/solo-cli/pull/40

@peterbarker

Example runs and install. Two issues to fix before can merge (that I will leave with you):

  1. Docs suggest connect on http://10.1.1.10:5000/ . Change URL to http://10.1.1.10:8080/
  2. Example completes with:
   * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)

Would be better if it said:

   * Connect to on http://10.1.1.10:8080/ on your browser (Press CTRL+C to quit)

FYI, I suspect the reason they went greenlets would be this note int he output:

WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance.
peterbarker commented 8 years ago

* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit) is not our message.

Will patch the docs.

franknitty69 commented 8 years ago

I was running the Webserver example and received the errors that this pr looks to fix. I was just curious if it will be merged.

mrpollo commented 8 years ago

thanks @peterbarker