diff --git a/Jenkinsfile b/Jenkinsfile index 4c67b04715807f9b3c94c88b518768e967b85786..f1c50f96a0c62338a4f2672a9cf6540a74d52646 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -120,7 +120,7 @@ pipeline { // upload package withCredentials([usernamePassword(credentialsId: 'nexusadmin', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) { - sh 'pip3 install twine' + sh 'pip3 install twine packaging' sh 'twine upload -u $USER -p $PASSWORD --repository-url ${NexusPyPiRepoUrl} hbp_nrp_virtual_coach/dist/*.whl' } } diff --git a/hbp_nrp_virtual_coach/doc/source/tutorials/launching_exp.rst b/hbp_nrp_virtual_coach/doc/source/tutorials/launching_exp.rst index 65f444591196dceee80ed3450c7f795b99f76cf1..673d2f6d7227b8d7305b9dc651ea0420a8566641 100644 --- a/hbp_nrp_virtual_coach/doc/source/tutorials/launching_exp.rst +++ b/hbp_nrp_virtual_coach/doc/source/tutorials/launching_exp.rst @@ -3,12 +3,15 @@ .. sectionauthor:: Eloy Retamino <retamino@ugr.es> Launching an Experiment from the Virtual Coach -======================================================== +============================================== Starting the Virtual Coach ^^^^^^^^^^^^^^^^^^^^^^^^^^ -There is a special alias for running the Virtual Coach. For this alias to work, :code:`$HBP/user-scripts/nrp_aliases` has to be sourced in your *bash.rc*. The ``configure_nrp`` script takes care of that automatically. The Virtual Coach alias is :code:`cle-virtual-coach` and can be run in three different ways: +Local source installation +~~~~~~~~~~~~~~~~~~~~~~~~~ + +In case you have installed NRP from the :ref:`source <source-installation>`, there is a special alias for running the Virtual Coach. For this alias to work, :code:`$HBP/user-scripts/nrp_aliases` has to be sourced in your *bash.rc*. The ``configure_nrp`` script takes care of that automatically. The Virtual Coach alias is :code:`cle-virtual-coach` and can be run in three different ways: There are different ways to start a Virtual Coach instance. With a local :abbr:`NRP (Neurorobotics Platform)` install you can use the alias :code:`cle-virtual-coach` in three different ways: @@ -26,6 +29,37 @@ There are different ways to start a Virtual Coach instance. With a local :abbr:` This information is also available in the alias help :code:`cle-virtual-coach -h`. + +Local Docker installation +~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can also use Virtual Coach with the local :ref:`Docker installation <docker-installation>`. In order to do that, you should follow these steps: + +1. Install the latest NRP Docker version with the command of :code:`./nrp_installer.sh install latest` the script exposes port 8888 by default for the Jupyter. + +2. Run :code:`./nrp_installer.sh connect_backend` which opens a terminal inside backend container. + +3. Run the command of :code:`cle-virtual-coach jupyter notebook "--ip=0.0.0.0"` inside backend container to start Jupyter. + +This will give you a URL like :code:`http://localhost:8888/?token=f027e20b23dd04d34ec827c6ff8ee402ccdf4c775d440766` that you should open with your browser. + +If you want to specify another port for Jupyter, the steps above change as follows: + +1. When installing nrp you need to add :code:`-np/--notebook_port <port_number>` to install command. For example, the command of :code:`./nrp_installer.sh -np 9875 install latest` will install nrp with port 9875 to be exposed for Jupyter. + +2. Run :code:`./nrp_installer.sh connect_backend` which opens a terminal inside backend container. + +3. Run the command of :code:`cle-virtual-coach jupyter notebook "--ip=0.0.0.0" --port=9875` inside backend container to start Jupyter on port specified in step 1. This command yields a URL that allow you to access the Jupyter notebook run on the container. + +To **test** that the installation was successful, create a new notebook and run this line of code: + +.. code-block:: python + + from pynrp import virtual_coach + +if you get no error running this cell, your Jupyter notebook is ready. + + Launching a Simulation ^^^^^^^^^^^^^^^^^^^^^^ The first thing we need to do is to import the Virtual Coach and create a VirtualCoach instance connected to an NRP server. diff --git a/hbp_nrp_virtual_coach/pynrp/virtual_coach.py b/hbp_nrp_virtual_coach/pynrp/virtual_coach.py index afb04d2b23a419b2c4e507df43fd54e5e1b1976c..896a101e49c69df27cf462d8e1d8c890bed7f392 100644 --- a/hbp_nrp_virtual_coach/pynrp/virtual_coach.py +++ b/hbp_nrp_virtual_coach/pynrp/virtual_coach.py @@ -182,7 +182,7 @@ class VirtualCoach(object): # the user is forwarded to the approve page if not approved yet if 'access_token' not in urlparse.urlparse(res.geturl()).fragment.lower(): raise Exception('Login to NRP online and give your consent. Then return to VC.') - + url_with_fragment = res.geturl() # parse and return token @@ -276,7 +276,7 @@ class VirtualCoach(object): sim = Simulation(self.__http_client, self.__config, self) for server_i in servers: try: - if sim.launch(experiment_id, str(experiment_conf), str(server_i), reservation, + if sim.launch(experiment_id, str(experiment_conf), str(server_i), reservation, cloned, self.__storage_token, brain_processes, profiler, recordingPath): return sim