raspberrypilearning / build-an-octapi

Other
84 stars 15 forks source link

project site feedback #11

Open MarcScott opened 5 years ago

MarcScott commented 5 years ago

URL: /en/projects/build-an-octapi/5 This doesn't work with the latest version of Raspbian (July 2019). It seems dispy and pycos only work really with Python2.7 or Python3.1. The latest Raspbian comes with Python3.7. From here ... https://github.com/pgiri/dispy I switched to using Python2.7 and I don't get the errors I was getting before, but it still doesn't work. I wondered if you had any more information? I'm trying to get this running for my daughter's school project. Appreciate any help if you've gone through this already. (dan.verdin@gmail.com)

MarcScott commented 5 years ago

On Servers

  1. rc.local not starting node on server
  2. Create start_dispynode.sh bash script as follows
    #!/bin/sh -e
    sleep 30
    _IP=$(hostname -I)
    printf "My IP address is %s\n" "$_IP"
    dispynode.py -i $_IP --daemon
  3. Make executable chmod +x start_displaynode.sh
  4. Run using cron @reboot sudo /home/pi/start_dispynode.sh

On client

  1. compute.py needs to know it's own IP address.
  2. Add the following into main function for when the JobCluster is created
    import dispy, random, socket
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.connect(("8.8.8.8", 80))
    cluster = dispy.JobCluster(compute,ip_addr=s.getsockname()[0], nodes='192.168.1.*')
jwest75674 commented 5 years ago

Another few additions:

On Servers

   #!/bin/sh -e
    sleep 30
    _IP=$(hostname -I)
    printf "My IP address is %s\n" "$_IP"
    dispynode.py -i $_IP -d --daemon

-d to enable debugging

On client

    import dispy, random, socket
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.connect(("8.8.8.8", 80))
    cluster = dispy.JobCluster(compute,ip_addr=s.getsockname()[0], nodes='192.168.1.*', loglevel=dispy.logger.DEBUG)

loglevel=dispy.logger.DEBUG to update the log level.

This was very helpful as I worked through some issues with the older project site instructions.