Skip to content

Commit 76a6aad

Browse files
authored
Update jupyter (#482)
* updating jupyter version and stack dependencies this enables many new ipython widgets and jupyter notebooks features * force fetch on Makefile:default_stack repos * added cycler package * added backports-shutil dep * added more ipython deps to stack * update stack commit again * fixing shapely in stack * removed scorec from default stack * added python-lzma * fixing default_stack target * updated Dockerfile to work with current jupyterhub * updated hashdist and hashstack commits * close hdf5 files after each test runs * updated test output, fixed gauge MPI bug, removed some warnings * tried to fix int conversion problem in WaveTools.py * added some system dependencies for travis builds * fixed spacing in .travis.yaml--got to get a yml emacs mode * trying pip install of pyliblzma so hit can do .xz files * turning down hit verbosity * updated hashdist to turn off progress bar that fills up logs * updated Dockerfile to allow multiple modes of running the container supports terminal, ipython, local notebook, and jupyterhub * updated Dockerfile with more OS packages and hashdist_default * updated zmq in stack and how pyzmq is build in Dockerfile * cleaned up Dockerfile and tried to fix pip3 pyzmq build * more stack and hashdist fixes * added new test data * fixed nbextensions in jupyterhub config * Close .h5 file in import module. * Delete renamed output files. * updated to petsc 3.7.5 * update version numbers and Dockerfile * added PROTEUS_RELEASE environment variable in .travis.yml * added better version extraction
1 parent 3f06ee6 commit 76a6aad

23 files changed

+316
-164
lines changed

.hashdist_default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
a23cfaa98e8fff6c4e9fc70f09417841e9e398b6
1+
95601061658628ad9da3be1a5538681ed1092634
22

33

44

.hashstack_default

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
ca8376dae614a5192d012bc0fd0124c596248723
2-
3-
4-
5-
1+
2ca88aa0ef486b86ad45191ea56c72ce641f8dda
62

73

84

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ addons:
1313
apt:
1414
packages:
1515
- gfortran
16+
- libffi-dev
17+
- python-lzma
18+
- libssl-dev
1619

1720
before_install:
1821
- wget https://dl.dropboxusercontent.com/u/26353144/hashdist_trusty.tgz
1922
- tar xzf hashdist_trusty.tgz
2023
- mv .hashdist $HOME
24+
- pip install pyliblzma
2125

2226
install:
2327
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
@@ -32,7 +36,7 @@ install:
3236
- ls $SSL_CERT_DIR
3337

3438
script:
35-
- py.test --boxed -v linux2/lib/python2.7/site-packages/proteus-1.1.0-py2.7-linux-x86_64.egg/proteus/tests
39+
- py.test --boxed -v linux2/lib/python2.7/site-packages/proteus-$(python -c "import proteus; print proteus.__version__")-py2.7-linux-x86_64.egg/proteus/tests
3640

3741
notifications:
3842
email:

Dockerfile

Lines changed: 73 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ MAINTAINER Proteus Project <[email protected]>
44

55
USER root
66

7-
# Install all OS dependencies for fully functional notebook server
87
ENV DEBIAN_FRONTEND noninteractive
9-
RUN apt-get update && apt-get install -yq --no-install-recommends --fix-missing \
8+
9+
RUN REPO=http://cdn-fastly.deb.debian.org \
10+
&& echo "deb $REPO/debian jessie main\ndeb $REPO/debian-security jessie/updates main" > /etc/apt/sources.list \
11+
&& apt-get update && apt-get -yq dist-upgrade \
12+
&& apt-get install -yq --no-install-recommends --fix-missing \
1013
git \
1114
vim \
1215
jed \
@@ -30,7 +33,15 @@ RUN apt-get update && apt-get install -yq --no-install-recommends --fix-missing
3033
libav-tools \
3134
libmpich2-dev \
3235
liblapack-dev \
36+
freeglut3 \
3337
freeglut3-dev \
38+
libglew1.5 \
39+
libglew1.5-dev \
40+
libglu1-mesa \
41+
libglu1-mesa-dev \
42+
libgl1-mesa-glx \
43+
libgl1-mesa-dev \
44+
curl \
3445
libjpeg-dev \
3546
m4 \
3647
libssl-dev \
@@ -50,16 +61,21 @@ RUN apt-get update && apt-get install -yq --no-install-recommends --fix-missing
5061
binfmt-support \
5162
python3-dev \
5263
python3-wheel \
53-
&& apt-get clean
64+
libffi-dev \
65+
python-lzma \
66+
python-pip \
67+
cmake \
68+
gfortran \
69+
&& apt-get clean \
70+
&& rm -rf /var/lib/apt/lists/*
5471

55-
RUN pip3 install notebook terminado
5672

5773
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
5874
locale-gen
5975

6076
# Install Tini
61-
RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.9.0/tini && \
62-
echo "faafbfb5b079303691a939a747d7f60591f2143164093727e870b289a44d9872 *tini" | sha256sum -c - && \
77+
RUN wget --quiet https://github.com/krallin/tini/releases/download/v0.10.0/tini && \
78+
echo "1361527f39190a7338a0b434bd8c88ff7233ce7b9a4876f3315c22fce7eca1b0 *tini" | sha256sum -c - && \
6379
mv tini /usr/local/bin/tini && \
6480
chmod +x /usr/local/bin/tini
6581

@@ -72,34 +88,29 @@ ENV LANG en_US.UTF-8
7288
ENV LANGUAGE en_US.UTF-8
7389

7490
# Create jovyan user with UID=1000 and in the 'users' group
75-
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER && \
76-
chown -R $NB_USER:users /home/$NB_USER
91+
RUN useradd -m -s /bin/bash -N -u $NB_UID $NB_USER
7792

78-
USER jovyan
93+
RUN mkdir /home/$NB_USER/.jupyter && \
94+
mkdir /home/$NB_USER/.local && \
95+
mkdir /home/$NB_USER/.hashdist && \
96+
echo "cacert=/etc/ssl/certs/ca-certificates.crt" > /home/$NB_USER/.curlrc
7997

80-
RUN mkdir /home/$NB_USER/work && \
81-
mkdir /home/$NB_USER/.jupyter && \
82-
mkdir /home/$NB_USER/.local
98+
ADD https://dl.dropboxusercontent.com/u/26353144/hashdist_config_jovyan.yaml /home/$NB_USER/.hashdist/config.yaml
8399

84-
#RUN wget https://dl.dropboxusercontent.com/u/26353144/hashdist_config_jovyan.yaml && \
85-
# mkdir /home/$NB_USER/.hashdist && \
86-
# mv hashdist_config_jovyan.yaml /home/$NB_USER/.hashdist/config.yaml && \
87-
# cat /home/$NB_USER/.hashdist/config.yaml
100+
RUN chown -R $NB_USER:users /home/$NB_USER
88101

89-
WORKDIR /home/$NB_USER
102+
USER jovyan
103+
104+
RUN ls /home/$NB_USER/.hashdist && \
105+
cat /home/$NB_USER/.hashdist/config.yaml
90106

91-
RUN git clone https://github.com/erdc-cm/workshops -b erdc-fsi-tutorials
107+
WORKDIR /home/$NB_USER
92108

93-
RUN git clone https://github.com/erdc-cm/proteus && \
109+
RUN cat /home/$NB_USER/.hashdist/config.yaml && \
110+
git clone https://github.com/erdc-cm/proteus && \
94111
cd proteus && \
95112
make hashdist stack stack/default.yaml && \
96113
cd stack && \
97-
git remote add erdc-cm http://github.com/erdc-cm/hashstack-private && \
98-
git fetch --all && \
99-
git checkout erdc-cm/cekees/kitchen_sink && \
100-
/usr/bin/mpicc -show && \
101-
which mpiexec && \
102-
which mpirun && \
103114
../hashdist/bin/hit build default.yaml -v
104115

105116
ENV CC mpicc
@@ -112,54 +123,55 @@ RUN cd proteus && make develop
112123
ENV PATH /home/$NB_USER/proteus/linux2/bin:$PATH
113124
ENV LD_LIBRARY_PATH /home/$NB_USER/proteus/linux2/lib:$LD_LIBRARY_PATH
114125

126+
RUN cd proteus && make jupyter
127+
115128
USER root
116129

117-
# Configure container startup as root
130+
RUN pip3 install pyzmq --install-option="--zmq=/home/$NB_USER/proteus/linux2"
131+
RUN pip3 install notebook jupyterhub jupyterlab terminado ipyparallel ipywidgets ipyleaflet jupyter_dashboards pythreejs cesiumpy
132+
RUN /usr/local/bin/jupyter serverextension enable --py jupyterlab --sys-prefix \
133+
&& /usr/local/bin/jupyter nbextension enable --py --sys-prefix widgetsnbextension \
134+
&& /usr/local/bin/jupyter nbextension enable --py --sys-prefix pythreejs \
135+
&& /usr/local/bin/jupyter nbextension enable --py --sys-prefix ipyleaflet \
136+
&& /usr/local/bin/jupyter dashboards quick-setup --sys-prefix
137+
118138
EXPOSE 8888
119-
WORKDIR /home/$NB_USER/work
139+
WORKDIR /home/$NB_USER
140+
120141
ENTRYPOINT ["tini", "--"]
121142
CMD ["start-notebook.sh"]
122143

123-
RUN cd /usr/local/bin && \
124-
wget https://raw.githubusercontent.com/jupyter/docker-stacks/master/minimal-notebook/start-notebook.sh
144+
# Add local files as late as possible to avoid cache busting
145+
ADD https://raw.githubusercontent.com/jupyter/docker-stacks/master/base-notebook/start.sh /usr/local/bin/start.sh
146+
ADD https://raw.githubusercontent.com/jupyter/docker-stacks/master/base-notebook/start-notebook.sh /usr/local/bin/start-notebook.sh
147+
ADD https://raw.githubusercontent.com/jupyter/docker-stacks/master/base-notebook/start-singleuser.sh /usr/local/bin/start-singleuser.sh
148+
ADD https://raw.githubusercontent.com/jupyter/docker-stacks/master/base-notebook/jupyter_notebook_config.py /home/$NB_USER/.jupyter/jupyter_notebook_config.py
125149

126-
ADD https://raw.githubusercontent.com/jupyter/docker-stacks/master/minimal-notebook/jupyter_notebook_config.py /home/$NB_USER/.jupyter/jupyter_notebook_config.py
150+
RUN chmod a+rx /usr/local/bin/*
127151

128-
RUN mkdir /etc/jupyter && \
129-
chmod a+rwX /etc/jupyter && \
130-
chown -R $NB_USER:users /home/$NB_USER
152+
RUN chown -R $NB_USER:users /home/$NB_USER/.jupyter
131153

132-
#jupyter/ipython extensions
133-
RUN pip3 install \
134-
ipyparallel \
135-
ipywidgets
154+
RUN jupyter kernelspec install-self
136155

137156
# Switch back to jovyan to avoid accidental container runs as root
138-
USER jovyan
139-
157+
USER $NB_USER
158+
140159
RUN cd ~/.jupyter && \
141160
ipython profile create mpi --parallel && \
142-
ipcluster nbextension enable && \
161+
ipcluster nbextension enable --user && \
143162
echo '\nc.NotebookApp.server_extensions.append("ipyparallel.nbextension")' >> /home/$NB_USER/.jupyter/jupyter_notebook_config.py && \
144-
cp jupyter_notebook_config.py /etc/jupyter/ && \
145163
echo "c.LocalControllerLauncher.controller_cmd = ['python2', '-m', 'ipyparallel.controller']\nc.LocalEngineSetLauncher.engine_cmd = ['python2', '-m', 'ipyparallel.engine']\n" \
146-
>> /home/$NB_USER/.ipython/profile_mpi/ipcluster_config.py
147-
148-
USER root
149-
150-
RUN jupyter kernelspec install-self
151-
152-
# fetch juptyerhub-singleuser entrypoint
153-
RUN wget -q https://raw.githubusercontent.com/jupyter/jupyterhub/master/scripts/jupyterhub-singleuser -O /usr/local/bin/jupyterhub-singleuser && \
154-
chmod 755 /usr/local/bin/jupyterhub-singleuser
155-
156-
ADD https://raw.githubusercontent.com/jupyter/dockerspawner/master/singleuser/singleuser.sh /srv/singleuser/singleuser.sh
157-
158-
RUN chmod 755 /srv/singleuser/singleuser.sh
159-
160-
USER jovyan
161-
162-
RUN cat /srv/singleuser/singleuser.sh
163-
# smoke test that it's importable at least
164-
RUN sh /srv/singleuser/singleuser.sh -h
165-
CMD ["sh", "/srv/singleuser/singleuser.sh"]
164+
>> /home/$NB_USER/.ipython/profile_mpi/ipcluster_config.py \
165+
&& jupyter serverextension enable --py jupyterlab --user \
166+
&& jupyter nbextension enable --py --user widgetsnbextension\
167+
&& jupyter nbextension install --py --user mayavi \
168+
&& jupyter nbextension enable --py --user bqplot \
169+
&& jupyter nbextension enable --py --user pythreejs \
170+
&& jupyter nbextension enable --py --user ipyleaflet \
171+
&& jupyter nbextension install --py --user rise \
172+
&& jupyter nbextension enable --py --user rise \
173+
&& jupyter dashboards quick-setup --user
174+
175+
# Import matplotlib the first time to build the font cache.
176+
ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
177+
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot"

Makefile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@ update:
108108
@echo "Type: git checkout -b branch_name to save changes"
109109
@echo "+======================================================================================================+"
110110

111-
default_stack: stack
111+
default_stack: stack hashdist
112112
cd stack; git fetch origin; git checkout -q ${HASHSTACK_DEFAULT_VERSION}
113113
@echo "Stack repository updated to .hashstack_default"
114114
HASHSTACK_VERSION=${HASHSTACK_DEFAULT_VERSION}
115+
@echo "hashdist repository updated to .hashdist_default"
116+
cd hashdist; git fetch origin; git checkout -q ${HASHDIST_DEFAULT_VERSION}
117+
HASHDIST_VERSION=${HASHDIST_DEFAULT_VERSION}
115118

116119
hashdist:
117120
@echo "No hashdist found. Cloning hashdist from GitHub"
@@ -155,7 +158,7 @@ ${PROTEUS_PREFIX}/artifact.json: stack/default.yaml stack hashdist $(shell find
155158

156159
$(call show_info)
157160

158-
cd stack && ${PROTEUS}/hashdist/bin/hit develop ${HIT_FLAGS} -v -f -k error default.yaml ${PROTEUS_PREFIX}
161+
cd stack && ${PROTEUS}/hashdist/bin/hit develop ${HIT_FLAGS} -f -k error default.yaml ${PROTEUS_PREFIX}
159162

160163
@echo "************************"
161164
@echo "Dependency build complete"
@@ -279,3 +282,18 @@ test:
279282
source ${PROTEUS_PREFIX}/bin/proteus_env.sh; py.test --boxed -v proteus/tests --ignore proteus/tests/POD
280283
@echo "Tests complete "
281284
@echo "************************************"
285+
286+
jupyter:
287+
@echo "************************************"
288+
@echo "Enabling jupyter notebook/lab/widgets"
289+
source ${PROTEUS_PREFIX}/bin/proteus_env.sh
290+
pip install jupyter jupyterlab ipywidgets ipyleaflet jupyter_dashboards pythreejs RISE cesiumpy bqplot mayavi
291+
jupyter serverextension enable --py jupyterlab --sys-prefix
292+
jupyter nbextension enable --py --sys-prefix widgetsnbextension
293+
jupyter nbextension install --py --sys-prefix mayavi
294+
jupyter nbextension enable --py --sys-prefix bqplot
295+
jupyter nbextension enable --py --sys-prefix pythreejs
296+
jupyter nbextension enable --py --sys-prefix ipyleaflet
297+
jupyter nbextension install --py --sys-prefix rise
298+
jupyter nbextension enable --py --sys-prefix rise
299+
jupyter dashboards quick-setup --sys-prefix

doc/source/_templates/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@
104104
style="height:1in;"> A Python toolkit for computational methods and simulation</p>
105105
<div class="btn-group" role="group">
106106
<a class="btn btn-success"
107-
href="https://github.com/erdc-cm/proteus/archive/v0.9.0.tar.gz">
107+
href="https://github.com/erdc-cm/proteus/archive/v1.2.0.tar.gz">
108108
<span class="glyphicon glyphicon-download"></span> Download
109109
</a>
110110
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
111111
<ul class="dropdown-menu">
112-
<li><a https://github.com/erdc-cm/proteus/archive/v0.9.0.tar.gz">Version 0.9.0</a></li>
112+
<li><a https://github.com/erdc-cm/proteus/archive/v1.2.0.tar.gz">Version 1.2.0</a></li>
113113
</ul>
114114
</div>
115115
</div>

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def linkcode_resolve(domain, info):
238238
# The name of an image file (within the static path) to use as favicon of the
239239
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
240240
# pixels large.
241-
html_favicon = "tritonBorder.ico"
241+
html_favicon = "_static/tritonBorder.ico"
242242

243243
# Add any paths that contain custom static files (such as style sheets) here,
244244
# relative to this directory. They are copied after the builtin static files,
@@ -327,7 +327,7 @@ def linkcode_resolve(domain, info):
327327
#latex_use_parts = False
328328

329329
# Additional stuff for the LaTeX preamble.
330-
latex_preamble = '\input{macros}'
330+
latex_elements['preamble'] = '\input{macros}'
331331

332332
# If true, show page references after internal links.
333333
#latex_show_pagerefs = False

proteus/Gauges.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ def findNearestNode(self, femSpace, location):
221221

222222
# determine global nearest node
223223
haveElement = int(local_element is not None)
224-
global_have_element, owning_proc = comm.allreduce(haveElement, op=MPI.MAXLOC)
224+
global_have_element, owning_proc = comm.allreduce((haveElement, comm.rank),
225+
op=MPI.MAXLOC)
225226
if global_have_element:
226227
logEvent("Gauges on element at location: [%g %g %g] assigned to %d" % (location[0], location[1], location[2],
227228
owning_proc), 3)

proteus/LinearSolvers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def solveInitialize(self,u,r,b,initialGuessIsZero=True):
9999
r=self.r
100100
else:
101101
self.r=r
102-
if b == None:
103-
if self.b == None:
102+
if b is None:
103+
if self.b is None:
104104
self.b = Vec(self.n)
105105
b=self.b
106106
else:

proteus/WaveTools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2535,7 +2535,7 @@ def writeEtaSeries(self,Tstart,Tend,dt,x0,fname, mode="all",setUp=False,Vgen=np.
25352535
Tlag = max(Tlag)
25362536
Tstart = Tstart - Tlag
25372537

2538-
Nseries = int(Tend - Tstart)/dt + 1
2538+
Nseries = int((Tend - Tstart)/dt) + 1
25392539
timelst=np.linspace(Tstart, Tend, Nseries)
25402540
series = np.zeros((Nseries,2),)
25412541
series[:,0] = timelst

0 commit comments

Comments
 (0)