From de61e2899f71f55eabeaeac2d5c50a9702905db7 Mon Sep 17 00:00:00 2001 From: "Morten W. Hansen" Date: Mon, 16 Sep 2019 18:20:59 +0200 Subject: [PATCH] #30: vm should now be set up correctly --- ...el-1 wind product from NERSC thredds.ipynb | 7 +- provisioning/conda_env_requirements.yml | 5 +- provisioning/roles/openwind/tasks/main.yml | 72 ++++++++----------- 3 files changed, 34 insertions(+), 50 deletions(-) diff --git a/notebooks/Validation of Sentinel-1 wind product from NERSC thredds.ipynb b/notebooks/Validation of Sentinel-1 wind product from NERSC thredds.ipynb index ac50a1f..d1d9e51 100644 --- a/notebooks/Validation of Sentinel-1 wind product from NERSC thredds.ipynb +++ b/notebooks/Validation of Sentinel-1 wind product from NERSC thredds.ipynb @@ -26,10 +26,9 @@ "outputs": [], "source": [ "import os, sys\n", - "sys.path.append('/home/vagrant/project')\n", - "sys.path.append('/vagrant')\n", - "os.environ['PROJ_LIB'] = '/home/vagrant/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/share/proj'\n", - "os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'" + "#sys.path.append('/home/vagrant/project')\n", + "#sys.path.append('/vagrant')\n", + "#os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'" ] }, { diff --git a/provisioning/conda_env_requirements.yml b/provisioning/conda_env_requirements.yml index cc617f8..afea1d0 100644 --- a/provisioning/conda_env_requirements.yml +++ b/provisioning/conda_env_requirements.yml @@ -6,11 +6,11 @@ dependencies: - scipy - django - gdal=2.4 - - binutils + # - binutils - pyproj - libspatialite - pythesint - #- nansat + # #- nansat - nose - coveralls - mock @@ -22,3 +22,4 @@ dependencies: - folium - jupyter - pip + # - git diff --git a/provisioning/roles/openwind/tasks/main.yml b/provisioning/roles/openwind/tasks/main.yml index 2aaf38f..c5aab20 100644 --- a/provisioning/roles/openwind/tasks/main.yml +++ b/provisioning/roles/openwind/tasks/main.yml @@ -3,50 +3,28 @@ #- name: openwind | Add PYTHONPATH to bashrc # lineinfile: dest="/home/vagrant/.bashrc" line="export PYTHONPATH=/vagrant" - - name: openwind | install git - apt: pkg="{{ item }}" - become: true - with_items: - - git - +#- name: openwind | install git +# apt: pkg=git +# become: true - name: openwind | Change owner of anaconda directory (otherwise later provisioning will fail) shell: "sudo chown -R vagrant {{ conda_dir }}/" - - name: openwind | create file activate.d/env_vars.sh in conda env - file: - path: "{{ conda_dir }}/envs/{{ env_name }}/etc/conda/activate.d/env_vars.sh" - state: touch - mode: u=rw,g=r,o=r - - - name: openwind | Set comment in environment variable file - lineinfile: - path: "{{ conda_dir }}/envs/{{ env_name }}/etc/conda/activate.d/env_vars.sh" - insertbefore: BOF - line: "#!/bin/bash" - - name: openwind | Set PYTHONPATH environment variable required by Nansat for use in Jupyter lineinfile: - path: "{{ conda_dir }}/envs/{{ env_name }}/etc/conda/activate.d/env_vars.sh" + path: /home/vagrant/.profile line: "export PYTHONPATH=/vagrant:{{ project_home }}:{{ project_home }}/{{ project_name }}" - name: openwind | Set PROJ_LIB environment variable required by Nansat for use in Jupyter lineinfile: - path: "{{ conda_dir }}/envs/{{ env_name }}/etc/conda/activate.d/env_vars.sh" + path: /home/vagrant/.profile line: "export PROJ_LIB={{ conda_dir }}/envs/{{ env_name }}/share/proj" - # - name: openwind | Create /etc/rc.local - # file: - # path: /etc/rc.local - # state: touch - # become: true + - name: openwind | Set PROJ_LIB environment variable required by Nansat for use in Jupyter + lineinfile: + path: /home/vagrant/.profile + line: "export DJANGO_SETTINGS_MODULE=project.settings" - # - name: openwind | rc.local heading - # lineinfile: - # path: /etc/rc.local - # insertbefore: BOF - # line: "#!/bin/sh -e" - - name: openwind | rc.local content blockinfile: path: /etc/rc.local @@ -54,6 +32,7 @@ block: | exec 1>/tmp/rc.local.log 2>&1 # send stdout and stderr from rc.local to a log file set -x + . /home/vagrant/.profile su vagrant -c "{{ conda_dir }}/envs/{{ env_name }}/bin/jupyter-notebook --ip=0.0.0.0 --no-browser --notebook-dir=/vagrant/ --NotebookApp.token=vagrant" & become: true @@ -129,6 +108,11 @@ state=link force=yes + - name: openwind | Install gcc + apt: + name: gcc + become: true + - name: openwind | Update/checkout Nansat git: repo=https://github.com/nansencenter/nansat dest="{{ dev_sources_dir }}/nansat/" @@ -139,19 +123,19 @@ - update-nansat ignore_errors: no - #- name: openwind | Clean Nansat (always run to keep the pixel functions updated) - # shell: 'python setup.py clean --all' - # args: - # chdir: '{{ dev_sources_dir }}/nansat' - # tags: - # - update-nansat - # - #- name: openwind | Install Nansat (always run to keep the pixel functions updated) - # shell: 'python setup.py build_ext --inplace' - # args: - # chdir: '{{ dev_sources_dir }}/nansat' - # tags: - # - update-nansat + - name: openwind | Clean Nansat (always run to keep the pixel functions updated) + shell: 'python setup.py clean --all' + args: + chdir: '{{ dev_sources_dir }}/nansat' + tags: + - update-nansat + + - name: openwind | Install Nansat (always run to keep the pixel functions updated) + shell: 'python setup.py build_ext --inplace' + args: + chdir: '{{ dev_sources_dir }}/nansat' + tags: + - update-nansat - name: openwind | Create link from Python dist-packages to nansat file: path='{{ python_dist_packages }}/nansat'