From a246890dc1db28725357fe3773d730e85557f89f Mon Sep 17 00:00:00 2001 From: bmorcos Date: Thu, 9 Apr 2020 11:48:39 -0400 Subject: [PATCH] Throw error on config not found - Removed tcp_socket attribute which did nothing - Changed warning to an error since ID extraction will be unsuccessful later anyways - Update bones --- .travis.yml | 2 +- CHANGES.rst | 2 ++ docs/conf.py | 2 ++ docs/examples/notebooks/06-chaotic-attractor.ipynb | 3 ++- nengo_fpga/id_extractor.py | 8 ++++---- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfc69d78..cf8cbb45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ before_install: # upgrade pip - pip install pip --upgrade # install/run nengo-bones - - pip install nengo-bones + - pip install git+https://github.com/nengo/nengo-bones#egg=nengo-bones - bones-generate --output-dir .ci ci-scripts - if [[ "$TRAVIS_PYTHON_VERSION" < "3.6" ]]; then echo "Skipping bones-check because Python $TRAVIS_PYTHON_VERSION < 3.6"; diff --git a/CHANGES.rst b/CHANGES.rst index 052f3e27..1e597f2b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -40,6 +40,8 @@ Release History (`#50 `__) - Improved socket communication for better performance. (`#52 `__) +- Throw an error with invalid config in ID script. + (`#53 `__) **Fixed** diff --git a/docs/conf.py b/docs/conf.py index d74760ce..71062696 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,6 +17,7 @@ "sphinx.ext.viewcode", "nbsphinx", "nengo_sphinx_theme", + "nengo_sphinx_theme.ext.backoff", "nengo_sphinx_theme.ext.redirects", "numpydoc", ] @@ -63,6 +64,7 @@ linkcheck_anchors = True default_role = "py:obj" pygments_style = "sphinx" +user_agent = "nengo_fpga" project = "NengoFPGA" authors = "Applied Brain Research" diff --git a/docs/examples/notebooks/06-chaotic-attractor.ipynb b/docs/examples/notebooks/06-chaotic-attractor.ipynb index 02ca8562..10d3aa9e 100644 --- a/docs/examples/notebooks/06-chaotic-attractor.ipynb +++ b/docs/examples/notebooks/06-chaotic-attractor.ipynb @@ -65,10 +65,11 @@ "\n", "import nengo\n", "\n", + "from mpl_toolkits.mplot3d import Axes3D\n", + "\n", "import nengo_fpga\n", "from nengo_fpga.networks import FpgaPesEnsembleNetwork\n", "\n", - "from mpl_toolkits.mplot3d import Axes3D\n", "from anim_utils import make_anim_chaotic" ] }, diff --git a/nengo_fpga/id_extractor.py b/nengo_fpga/id_extractor.py index be3a658c..e826faf5 100644 --- a/nengo_fpga/id_extractor.py +++ b/nengo_fpga/id_extractor.py @@ -2,6 +2,7 @@ import socket import os +import sys import threading import numpy as np import paramiko @@ -54,12 +55,12 @@ def __init__(self, fpga_name, max_attempts=5, timeout=5): self.tcp_recv = None # Placeholder until socket is connected else: - # FPGA name not found, throw a warning. + # FPGA name not found, unable to retrieve ID print( - "WARNING: Specified FPGA configuration '" + fpga_name + "' not found.", + "ERROR: Specified FPGA configuration '" + fpga_name + "' not found.", flush=True, ) - self.tcp_socket = None + sys.exit() def cleanup(self): """Shutdown socket and SSH connection""" @@ -256,7 +257,6 @@ def recv_id(self): if __name__ == "__main__": import argparse - import sys parser = argparse.ArgumentParser( description="Generic script for running the ID Extractor on the "