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

RuntimeError: generator raised StopIteration -- Tutorial no longer works? #3

Closed
jwest75674 opened this issue Jul 13, 2019 · 8 comments
Assignees

Comments

@jwest75674
Copy link

Basically, I am just following the tutorial at:
https://projects.raspberrypi.org/en/projects/build-an-octapi/

No Unicorn hats :'(

At the "Check that it works" stage, which, apparently not....?

Running on a dedicated router, not connected to the net.
Been through the wpa_supplicant.conf to clean it up, and have the server running dispy as a daemon, etc.

(Followed the instruction very closely)

I suspect the issue is related to some change in either Python, or raspbian since the tutorial was written, but not really sure how to address...

Here's my full SSH dump:
(I am on windows 10, if that matters, using putty)

login as: pi
[email protected]'s password: //// running on 192.168.10.* --> Updated the ip reference in compute.py, but no luck there...
Linux raspberrypi-HEAD 4.19.50-v7+ #896 SMP Thu Jun 20 16:11:44 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Jul 13 03:01:01 2019 from 192.168.1.62
pi@raspberrypi-HEAD:~ $ ls /// bunch of log files?
cluster_action.sh _dispy_20190712053410.db primality_canonical.py
compute_pi_canonical.py _dispy_20190712054557.db primality_efficient.py
compute_pi_efficient.py _dispy_20190712054718.db primality_standalone.py
compute_pi_standalone.py _dispy_20190712054806.db semi_prime_standalone.py
compute.py factor_efficient.py sherlock
_dispy_20190712051543.db factor_standalone.py
_dispy_20190712051802.db octapi-setup
pi@raspberrypi-HEAD:~ $ sudo python3 compute.py
2019-07-13 03:03:43 asyncoro - version 4.5.6 with epoll I/O notifier
2019-07-13 03:03:43 dispy - dispy client version: 4.7.1
2019-07-13 03:03:43 asyncoro - uncaught exception in ~port_bound/1982380760:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 734, in port_bound
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:03:43 asyncoro - uncaught exception in ~tcp_server/1971539792:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 853, in tcp_server
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:03:43 dispy - Storing fault recovery information in "_dispy_20190713030343"
2019-07-13 03:03:43 asyncoro - uncaught exception in ~_schedule_jobs/1971600088:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2356, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 1794, in _schedule_jobs
yield self._sched_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

projectTraceback (most recent call last):
File "compute.py", line 42, in
host, n = job() # waits for job to finish and returns results
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 121, in call
self.finish.wait()
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
projectError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
pi@raspberrypi-HEAD:~ $ ls
cluster_action.sh _dispy_20190712053410.db octapi-setup
compute_pi_canonical.py _dispy_20190712054557.db primality_canonical.py
compute_pi_efficient.py _dispy_20190712054718.db primality_efficient.py
compute_pi_standalone.py _dispy_20190712054806.db primality_standalone.py
compute.py _dispy_20190713030343.db semi_prime_standalone.py
_dispy_20190712051543.db factor_efficient.py sherlock
_dispy_20190712051802.db factor_standalone.py
pi@raspberrypi-HEAD:~ $ sudo nano compute.py
pi@raspberrypi-HEAD:~ $ sudo python3 compute.py
2019-07-13 03:07:24 asyncoro - version 4.5.6 with epoll I/O notifier
2019-07-13 03:07:24 dispy - dispy client version: 4.7.1
2019-07-13 03:07:24 asyncoro - uncaught exception in ~port_bound/1981081448:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 734, in port_bound
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:07:24 asyncoro - uncaught exception in ~tcp_server/1970630480:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 853, in tcp_server
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:07:24 dispy - Storing fault recovery information in "_dispy_20190713030724"
2019-07-13 03:07:24 asyncoro - uncaught exception in ~_schedule_jobs/1970686680:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2356, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 1794, in _schedule_jobs
yield self._sched_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

projectTraceback (most recent call last):
File "compute.py", line 42, in
host, n = job() # waits for job to finish and returns results
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 121, in call
self.finish.wait()
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
projectError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
pi@raspberrypi-HEAD:~ $ sudo nano compute.py //trying different IP addresses...
pi@raspberrypi-HEAD:~ $ sudo python3 compute.py
2019-07-13 03:07:42 asyncoro - version 4.5.6 with epoll I/O notifier
2019-07-13 03:07:42 dispy - dispy client version: 4.7.1
2019-07-13 03:07:42 asyncoro - uncaught exception in ~port_bound/1981331304:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 734, in port_bound
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:07:42 asyncoro - uncaught exception in ~tcp_server/1970863952:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2341, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 853, in tcp_server
yield port_bound_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

2019-07-13 03:07:42 dispy - Storing fault recovery information in "_dispy_20190713030742"
2019-07-13 03:07:42 asyncoro - uncaught exception in ~_schedule_jobs/1970924248:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 2356, in wait
raise StopIteration(True)
StopIteration: True

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3750, in _schedule
retval = coro._generator.throw(*exc)
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 1794, in _schedule_jobs
yield self._sched_event.wait()
File "/usr/local/lib/python3.7/dist-packages/asyncoro/init.py", line 3752, in _schedule
retval = coro._generator.send(coro._value)
RuntimeError: generator raised StopIteration

projectTraceback (most recent call last):
File "compute.py", line 42, in
host, n = job() # waits for job to finish and returns results
File "/usr/local/lib/python3.7/dist-packages/dispy/init.py", line 121, in call
self.finish.wait()
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
projectError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 552, in wait
signaled = self._cond.wait(timeout)
File "/usr/lib/python3.7/threading.py", line 296, in wait
waiter.acquire()
KeyboardInterrupt
pi@raspberrypi-HEAD:~ $omgwtf why this no work.

@MarcScott
Copy link
Contributor

@lawsie I'm planning on running through the project to test this issue, but if you have an insight / resolution that you can see at a glance, it might save me some time. No worries if you don't have capacity at the moment.

@lawsie
Copy link
Contributor

lawsie commented Jul 29, 2019

I don't know what version of Raspbian this was used on (likely Buster?) but this resource was written for Jessie (I think) and so it's very likely that what has happened is that asyncoro (which dispy relies upon) does not now work with current Raspbian. We had to put in the line to install dispy v 4.7.1 because of another problem at the time of writing where higher versions of dispy used a different middleware that wasn't compatible with Raspbian either.

I don't know anything about the way dispy works with Raspbian, but my first port of call if I were you @MarcScott would be to find out whether dispy is even compatible with Raspbian any more and go from there?

@jwest75674
Copy link
Author

jwest75674 commented Aug 7, 2019

Sorry for the delay:

I managed to get this working by simply changing all python3 references to python2. Which obviously is not ideal, but as a novice with both linux and python, this was a lucky shot in the dark that worked for me. I kept using dispy==4.7.1 and otherwise dropped the '3' from all python3 references, and everything works.

On an unrelated note, the cluster_action.sh could really use:
A way to install pip packages.
A maintenance routine to update everything that can be updated safely.

Additionally, for anyone who comes across this ahead of the install. I (mr. smarty-pants) thought it was smart to get a headless version of Raspbian with the intent to use the command line for everything. Works great, save for the Client/Master would have really benefit from a GUI to allow using dispy's built in web admin panel more easily. (I am sure there is a way, but knowing what I do now, a month later, I would have started with a full install for the Client/Master node. As they say: RTFM.)

I'll work on figuring it out the cluster_action.sh items, but adding bash to the learning list wasn't immediately on the game plan. haha

@MarcScott
Copy link
Contributor

MarcScott commented Aug 29, 2019

@jwest75674 I currently have a working version and will be updating the project instructions.
I'm using latest versions of dispy and pycos

See - raspberrypilearning/build-an-octapi#11

@jwest75674
Copy link
Author

jwest75674 commented Aug 29, 2019

Sounds great! I was actually in the process of switching my octa-pi to Python 3.7, so I am confident your updates will help me along the path too!

I can contribute to the readme too at this point as I've learned lots. Will send a pull request with some useful info.

@jwest75674
Copy link
Author

I've actually noted a handful of bugs being run into with dispy 4.7.1 which is pushing me down the path for upgrading.

Looking at the commits over the last few weeks, has the primary update to get dispy working on the latest version simply been the need to pass the client/head ip_addr when creating the job cluster, or have there been other changes/considerations that need to be taken into account?

@MarcScott
Copy link
Contributor

From my testing, it's just getting the client IP that has changed in the cluster, which can be achieved with the hacky 8.8.8.8 call.
Looks like there's an nmap change as well, as the previous control script was gathering hostnames rather than IP addresses.
I'm awaiting some external reviews before pushing this live, and then looking at the next set of octapi resources, so can't close this yet.

@MarcScott
Copy link
Contributor

Fixed last year and forgot to close the issue

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

No branches or pull requests

3 participants