Skip to content

Commit c4109cd

Browse files
authored
Merge branch 'development' into feature/netpyne-102
2 parents 8279ee5 + 5350849 commit c4109cd

98 files changed

Lines changed: 2745 additions & 304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,135 @@ jobs:
5858
npm run Experiment_Manager_test
5959
env:
6060
CI: true
61+
Tutorial_1-SmokeTest:
62+
# The type of runner that the job will run on
63+
runs-on: ubuntu-20.04
64+
container: lironavon/docker-puppeteer-container:14.16.0
65+
env:
66+
CI: true
67+
steps:
68+
- uses: actions/checkout@v1
69+
- name: Use Node.js ${{ matrix.node-version }}
70+
uses: actions/setup-node@v1
71+
with:
72+
node-version: ${{ matrix.node-version }}
73+
cache-dependency-path: frontend/e2e/tests/package-lock.json
74+
- name: Tutorial 1 Plot Tests
75+
run: |
76+
cd tests/frontend/e2e
77+
#install dependencies
78+
npm ci
79+
# run Tutorial 1 Plot Tests
80+
npm run Tutorial_1_test
81+
env:
82+
CI: true
83+
Tutorial_2-SmokeTest:
84+
# The type of runner that the job will run on
85+
runs-on: ubuntu-20.04
86+
container: lironavon/docker-puppeteer-container:14.16.0
87+
env:
88+
CI: true
89+
steps:
90+
- uses: actions/checkout@v1
91+
- name: Use Node.js ${{ matrix.node-version }}
92+
uses: actions/setup-node@v1
93+
with:
94+
node-version: ${{ matrix.node-version }}
95+
cache-dependency-path: frontend/e2e/tests/package-lock.json
96+
- name: Tutorial 2 Plot Tests
97+
run: |
98+
cd tests/frontend/e2e
99+
#install dependencies
100+
npm ci
101+
# run Tutorial 2 Plot Tests
102+
npm run Tutorial_2_test
103+
env:
104+
CI: true
105+
Tutorial_3a-SmokeTest:
106+
# The type of runner that the job will run on
107+
runs-on: ubuntu-20.04
108+
container: lironavon/docker-puppeteer-container:14.16.0
109+
env:
110+
CI: true
111+
steps:
112+
- uses: actions/checkout@v1
113+
- name: Use Node.js ${{ matrix.node-version }}
114+
uses: actions/setup-node@v1
115+
with:
116+
node-version: ${{ matrix.node-version }}
117+
cache-dependency-path: frontend/e2e/tests/package-lock.json
118+
- name: Tutorial 3a Plot Tests
119+
run: |
120+
cd tests/frontend/e2e
121+
#install dependencies
122+
npm ci
123+
# run Tutorial 3a Plot Tests
124+
npm run Tutorial_3A_test
125+
env:
126+
CI: true
127+
Tutorial_3b-SmokeTest:
128+
# The type of runner that the job will run on
129+
runs-on: ubuntu-20.04
130+
container: lironavon/docker-puppeteer-container:14.16.0
131+
env:
132+
CI: true
133+
steps:
134+
- uses: actions/checkout@v1
135+
- name: Use Node.js ${{ matrix.node-version }}
136+
uses: actions/setup-node@v1
137+
with:
138+
node-version: ${{ matrix.node-version }}
139+
cache-dependency-path: frontend/e2e/tests/package-lock.json
140+
- name: Tutorial 3b Plot Tests
141+
run: |
142+
cd tests/frontend/e2e
143+
#install dependencies
144+
npm ci
145+
# run Tutorial 3b Plot Tests
146+
npm run Tutorial_3B_test
147+
env:
148+
CI: true
149+
Tutorial_3c-SmokeTest:
150+
# The type of runner that the job will run on
151+
runs-on: ubuntu-20.04
152+
container: lironavon/docker-puppeteer-container:14.16.0
153+
env:
154+
CI: true
155+
steps:
156+
- uses: actions/checkout@v1
157+
- name: Use Node.js ${{ matrix.node-version }}
158+
uses: actions/setup-node@v1
159+
with:
160+
node-version: ${{ matrix.node-version }}
161+
cache-dependency-path: frontend/e2e/tests/package-lock.json
162+
- name: Tutorial 3c Plot Tests
163+
run: |
164+
cd tests/frontend/e2e
165+
#install dependencies
166+
npm ci
167+
# run Tutorial 3c Plot Tests
168+
npm run Tutorial_3C_test
169+
env:
170+
CI: true
171+
Tutorial_4-SmokeTest:
172+
# The type of runner that the job will run on
173+
runs-on: ubuntu-20.04
174+
container: lironavon/docker-puppeteer-container:14.16.0
175+
env:
176+
CI: true
177+
steps:
178+
- uses: actions/checkout@v1
179+
- name: Use Node.js ${{ matrix.node-version }}
180+
uses: actions/setup-node@v1
181+
with:
182+
node-version: ${{ matrix.node-version }}
183+
cache-dependency-path: frontend/e2e/tests/package-lock.json
184+
- name: Tutorial 4 Plot Tests
185+
run: |
186+
cd tests/frontend/e2e
187+
#install dependencies
188+
npm ci
189+
# run Tutorial 4 Plot Tests
190+
npm run Tutorial_4_test
191+
env:
192+
CI: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ utilities/x86_64
2727
x86_64
2828
.jupyter-config
2929
venv
30+
webapp/build
31+
webapp/.yalc
3032
node_modules
33+
sa_nyhead.mat

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ ENV NB_UID=jovyan
2020
ENV FOLDER=netpyne
2121
ARG GEPPETTO_VERSION=development
2222
ARG BUILD_ARGS=""
23+
ARG NETPYNE_VERSION=master
24+
ARG WORKSPACE_VERSION=master
2325

2426
ENV FOLDER=/home/jovyan/work/NetPyNE-UI
2527

2628
USER root
2729

2830
RUN rm -rf /var/lib/apt/lists
2931
RUN apt-get update -qq &&\
30-
apt-get install python3-tk vim nano unzip git make libtool g++ -qq pkg-config libfreetype6-dev libpng-dev libopenmpi-dev -y
32+
apt-get install python3-tk vim nano unzip git make libtool g++ -qq pkg-config libfreetype6-dev libpng-dev libopenmpi-dev openjdk-11-jre-headless -y -y
3133
RUN conda install python=3.7 -y
3234

3335

@@ -44,25 +46,22 @@ RUN jupyter nbextension enable --py --sys-prefix jupyter_geppetto
4446
RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension
4547
RUN jupyter serverextension enable --py --sys-prefix jupyter_geppetto
4648

47-
RUN python utilities/install.py ${BUILD_ARGS} --geppetto ${GEPPETTO_VERSION} --npm-skip
49+
RUN python utilities/install.py ${BUILD_ARGS} --geppetto ${GEPPETTO_VERSION} --netpyne $NETPYNE_VERSION --workspace WORKSPACE_VERSION --npm-skip
4850

4951
RUN jupyter labextension disable @jupyterlab/hub-extension
5052

5153
RUN chown $NB_UID .
5254
RUN chown -R $NB_UID workspace
5355

5456
# Temp fixes for eeg plots
57+
ENV NEURON_HOME=/opt/conda
5558
# For lfpykit 0.4
5659
# RUN wget -P $(pip show LFPykit | grep "Location:" | awk '{print $2"/lfpykit"}') https://www.parralab.org/nyhead/sa_nyhead.mat
5760
# For lpfykit 0.5
5861
RUN wget --no-check-certificate -P ${FOLDER}/workspace https://www.parralab.org/nyhead/sa_nyhead.mat
5962

6063
USER $NB_UID
6164

62-
6365
EXPOSE 8888
6466

6567

66-
67-
68-

NetPyNE-UI

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
CONFIG=$(pwd)/.jupyter-config
33
export JUPYTER_CONFIG_DIR=$CONFIG
4-
exec jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui --NotebookApp.disable_check_xsrf=True
4+
exec jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token='' --NotebookApp.notebook_dir=workspace --library=netpyne_ui --NotebookApp.disable_check_xsrf=True

netpyne_ui/api.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def allowed_file(filename, allowed_extensions=ALLOWED_EXTENSIONS):
1919
def send_files(handler, file_path, filename):
2020
with open(file_path, "rb") as f:
2121
handler.set_header('Content-Type', 'application/force-download')
22-
handler.set_header('Content-Disposition', f"attachment; filename={filename}")
22+
handler.set_header('Content-Disposition',
23+
f"attachment; filename={filename}")
2324

2425
try:
2526
while True:
@@ -36,7 +37,8 @@ def get_file_paths(handler):
3637
file_paths = False
3738
if 'uri' in handler.request.arguments:
3839
file_paths = []
39-
tmp_file_paths = [path.decode('utf-8') for path in handler.request.arguments['uri']]
40+
tmp_file_paths = [path.decode('utf-8')
41+
for path in handler.request.arguments['uri']]
4042
for path in tmp_file_paths:
4143
if os.path.exists(path):
4244
file_paths.append(path)
@@ -69,12 +71,14 @@ def uploads(handler: IPythonHandler):
6971
files_saved = 0
7072

7173
if len(files) == 0 or 'file' not in files:
72-
handler.set_status(400, f"Can't find 'file' or filename is empty. Files received {len(files)}")
74+
handler.set_status(
75+
400, f"Can't find 'file' or filename is empty. Files received {len(files)}")
7376
else:
7477

7578
for f in files['file']:
7679
if not allowed_file(f.filename):
77-
logging.warn(f"Can't store file {f.filename}. Extension not allowed")
80+
logging.warn(
81+
f"Can't store file {f.filename}. Extension not allowed")
7882
continue
7983

8084
# Save to file
@@ -120,8 +124,42 @@ def downloads(handler: IPythonHandler):
120124
tar_gz_file_path = os.path.join(dir_path, tar_gz_file_name)
121125
with tarfile.open(tar_gz_file_path, mode='w:gz') as tar:
122126
for file_path in file_paths:
123-
tar.add(file_path, os.path.join('download', file_path.split('/')[-1]))
127+
tar.add(file_path, os.path.join(
128+
'download', file_path.split('/')[-1]))
124129

125130
send_files(handler, tar_gz_file_path, tar_gz_file_name)
126131

127132
handler.finish()
133+
134+
135+
def create_notebook(filename):
136+
import nbformat as nbf
137+
from nbformat.v4.nbbase import new_notebook
138+
from nbformat import sign
139+
import codecs
140+
141+
directory = os.path.dirname(filename)
142+
if not os.path.exists(directory):
143+
os.makedirs(directory)
144+
nb0 = new_notebook(cells=[nbf.v4.new_markdown_cell("""# Welcome to the NetPyNE-ui!
145+
146+
"""),
147+
nbf.v4.new_code_cell(
148+
'netpyne_geppetto.netParams'),
149+
nbf.v4.new_code_cell(
150+
'netpyne_geppetto.simConfig')
151+
], metadata={"kernelspec": {
152+
"display_name": "Python 3",
153+
"language": "python",
154+
"name": "python3"
155+
}})
156+
157+
f = codecs.open(filename, encoding='utf-8', mode='w')
158+
159+
nbf.write(nb0, filename)
160+
f.close()
161+
162+
163+
# TODO move to jupyter geppetto, using notebook dir path
164+
if os.path.exists('workspace') and not os.path.exists('workspace/notebook.ipynb'):
165+
create_notebook('workspace/notebook.ipynb')

netpyne_ui/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TEMPLATE_FILENAME_BATCH_RUN = "batch_run_single.py"
1212
TEMPLATE_FILENAME_BATCH = "batch.py"
1313

14-
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg", "hoc", "json"]
14+
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg", "hoc", "json", "xml", "nml"]
1515
HERE = os.path.dirname(os.path.abspath(__file__))
1616
ROOT = os.path.dirname(HERE)
1717
UPLOAD_FOLDER_PATH = os.path.join(ROOT, NETPYNE_WORKDIR, UPLOAD_FOLDER_NAME)

0 commit comments

Comments
 (0)