Skip to content

Commit 45dc027

Browse files
Merge pull request #92 from zitrosolrac/updatingDev
Migrating performance from public site
2 parents 60dca99 + e1b4c60 commit 45dc027

File tree

48 files changed

+524
-353
lines changed

Some content is hidden

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

48 files changed

+524
-353
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ AWS_ACCESS_KEY_ID=aws_key
1919
AWS_SECRET_ACCESS_KEY=aws_secret
2020
DEMO_PASSWORD=ibl_navigator_password
2121
JWT_SECRET=secret
22+
API_MODE=[public | private]
2223
# utilized for remote deployment
2324
SUBDOMAINS=sub
2425
URL=example.com
@@ -108,4 +109,4 @@ make sure to move over to the `master` branch by `git checkout master`
108109
`docker-compose -f docker-compose-deploy.yml pull` to get the ibl-navigator container
109110
`docker-compose -f docker-compose-deploy.yml up -d`
110111

111-
-------------------------------------
112+
-------------------------------------

backend/iblapi.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ def do_req(subpath):
172172
# construct kwargs
173173
kwargs = {'as_dict': True}
174174
limit = int(request.values['__limit']) if '__limit' in values else None
175-
order = request.values['__order'] if '__order' in values else None
175+
order = request.values['__order'] if '__order' in values else 'KEY ASC'
176+
page = int(request.values['__page']) if '__page' in values else 1
176177
proj = json.loads(request.values['__proj']) if '__proj' in values else None
177-
special_fields = ['__json', '__limit', '__order', '__proj', '__json_kwargs']
178-
for a in (v for v in values if v not in special_fields):
178+
special_fields = ['__json', '__limit', '__order', '__proj', '__json_kwargs',
179+
'__page']
180+
for a in (k for k, v in values.items() if k not in special_fields and v):
179181
# HACK: 'uuid' attrs -> UUID type (see also: datajoint-python #594)
180182
postargs[a] = UUID(values[a]) if 'uuid' in a else values[a]
181183
args = [postargs] if len(postargs) else []
@@ -186,9 +188,14 @@ def do_req(subpath):
186188
if '__json_kwargs' in values:
187189
json_kwargs = json.loads(request.values['__json_kwargs'])
188190
args = {} if not args else dj.AndList(args)
189-
kwargs = {k: v for k, v in (('as_dict', True,),
190-
('limit', limit,),
191-
('order_by', order,)) if v is not None}
191+
if limit == None:
192+
kwargs = {k: v for k, v in (('as_dict', True,),
193+
('order_by', order,)) if v is not None}
194+
else:
195+
kwargs = {k: v for k, v in (('as_dict', True,),
196+
('limit', limit,),
197+
('order_by', order,),
198+
('offset', (page-1)*limit)) if v is not None}
192199
# 2) and dispatch
193200
app.logger.debug("args: '{}', kwargs: {}".format(args, kwargs))
194201
if obj not in reqmap:
@@ -216,8 +223,7 @@ def handle_q(subpath, args, proj, fetch_args=None, **kwargs):
216223
((session * subject * lab * user) & arg).proj(flist)
217224
'''
218225
app.logger.info("handle_q: subpath: '{}', args: {}".format(subpath, args))
219-
app.logger.info('key words: {}'.format(kwargs))
220-
226+
221227
fetch_args = {} if fetch_args is None else fetch_args
222228
ret = []
223229
post_process = None
@@ -266,10 +272,12 @@ def handle_q(subpath, args, proj, fetch_args=None, **kwargs):
266272

267273
q = ((acquisition.Session() * sess_proj * psych_curve * ephys_data * subject.Subject() *
268274
subject.SubjectLab() * subject.SubjectUser() * trainingStatus) & args & brain_restriction)
269-
275+
q = q.proj(*proj) if proj else q
270276
dj.conn().query("SET SESSION max_join_size={}".format('18446744073709551615'))
271-
q = q.proj(*proj).fetch(**fetch_args) if proj else q.fetch(**fetch_args)
277+
ret_count = len(q)
278+
ret = q.fetch(**fetch_args)
272279
dj.conn().query("SET SESSION max_join_size={}".format(original_max_join_size))
280+
return dumps({"records_count": ret_count, "records": ret})
273281
elif subpath == 'subjpage':
274282
proj_restr = None
275283
for e in args:

docker-compose-base.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ x-net: &net
88
services:
99
iblapi:
1010
<<: *net
11-
image: registry.vathes.com/ibl-navigator/iblapi:v0.5.3 # for internal demo
11+
image: registry.vathes.com/ibl-navigator/iblapi:v0.6.0 # for internal demo
1212
# image: registry.vathes.com/ibl-navigator/iblapi:v0.1.0-public # for public demo
1313
environment:
1414
- DJ_USER=maho
@@ -31,15 +31,16 @@ services:
3131
#cpu_period: 100ms
3232
ibl-navigator:
3333
<<: *net
34-
image: registry.vathes.com/ibl-navigator/frontend:v0.4.2 # for internal demo
34+
image: registry.vathes.com/ibl-navigator/frontend:v0.5.0 # for internal demo
3535
# image: registry.vathes.com/ibl-navigator/frontend:v0.1.0-public # for public demo
3636
healthcheck:
3737
test: curl --fail http://localhost:9000 || exit 1
3838
timeout: 3s
3939
retries: 20
4040
ibl-node-server:
4141
<<: *net
42-
image: registry.vathes.com/ibl-navigator/node-server:v0.3.0 # for internal demo
42+
platform: linux/amd64
43+
image: registry.vathes.com/ibl-navigator/node-server:v0.4.0 # for internal demo
4344
# image: registry.vathes.com/ibl-navigator/node-server:v0.1.0-public # for public demo
4445
environment:
4546
- NODE_ENV=development
@@ -71,7 +72,7 @@ services:
7172
# condition: service_healthy
7273
nginx:
7374
<<: *net
74-
image: datajoint/nginx:v0.0.16
75+
image: datajoint/nginx:v0.0.18
7576
environment:
7677
- ADD_zfrontend_TYPE=REST
7778
- ADD_zfrontend_ENDPOINT=ibl-navigator:9000

docker-compose-dev.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ services:
3535
service: ibl-node-server
3636
image: ibl-node-server:v0.0.0
3737
# command: nodemon /src/server.js
38+
# command: npm test
39+
ports:
40+
- "9222:9222"
3841
volumes:
3942
- ./node_server/app.js:/src/app.js
4043
<<: *net

ibl-frontend/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
FROM vathes/angulardev:angcli7.1.4-angbuild0.11.4
1+
# FROM vathes/angulardev:angcli7.1.4-angbuild0.11.4
2+
3+
FROM node:12-bullseye
4+
5+
RUN \
6+
apt update && \
7+
apt install nginx -y
28

39
WORKDIR /app/dist/pipeline-viewer
410

@@ -10,10 +16,9 @@ COPY ./app.conf /etc/nginx/conf.d/default.conf
1016
CMD ["nginx", "-g", "daemon off;"]
1117

1218
ADD ./frontend-content/package.json /app/
13-
ADD ./frontend-content/package-lock.json /app/
1419
RUN \
1520
cd /app && \
16-
npm install --save-dev @angular-devkit/build-angular > /dev/null
21+
npm install
1722

1823

1924
ADD ./frontend-content /app
@@ -23,7 +28,7 @@ COPY ./frontend-content/src/assets/addons/plotly.js /app/node_modules/plotly.js-
2328

2429
RUN \
2530
cd /app && \
26-
node --max_old_space_size=8192 /usr/local/lib/node_modules/@angular/cli/bin/ng build --prod
31+
node --max_old_space_size=5120 /app/node_modules/@angular/cli/bin/ng build --configuration production
2732

2833

2934
# CMD ["http-server","-p", "8080" ,"-a","0.0.0.0"]

ibl-frontend/dev.dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# don't build
2-
FROM vathes/angulardev:angcli7.1.4-angbuild0.11.4
2+
# FROM vathes/angulardev:angcli7.1.4-angbuild0.11.4
3+
4+
FROM node:12-bullseye
35

46
HEALTHCHECK \
57
--timeout=3s \
@@ -10,12 +12,10 @@ HEALTHCHECK \
1012
COPY ./entrypoint.sh /entrypoint.sh
1113
RUN chmod +x /entrypoint.sh
1214
ENTRYPOINT ["/entrypoint.sh"]
13-
CMD ["ng","serve","--host","0.0.0.0","--port","9000","--disable-host-check"]
1415

1516
WORKDIR /app
1617

1718
ADD ./frontend-content/package.json /app/
18-
ADD ./frontend-content/package-lock.json /app/
1919
RUN \
2020
npm install && \
2121
npm install --only=dev
@@ -24,5 +24,6 @@ ADD ./frontend-content /app
2424
COPY ./frontend-content/src/assets/addons/indigo-pink-ibl.css /app/node_modules/\@angular/material/prebuilt-themes/
2525
COPY ./frontend-content/src/assets/addons/plotly.js /app/node_modules/plotly.js-dist/
2626

27+
CMD ["node", "--max_old_space_size=5120", "/app/node_modules/@angular/cli/bin/ng", "serve", "--host", "0.0.0.0", "--port", "9000", "--disable-host-check"]
2728

28-
29+
# node --max_old_space_size=5120 /app/node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --port 9000 --disable-host-check 1> /app/src/output.log 2> /app/src/error.log

ibl-frontend/frontend-content/angular.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,25 @@
2323
"src/assets"
2424
],
2525
"styles": [
26-
"node_modules/bootstrap/dist/css/bootstrap.min.css",
26+
{
27+
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink-ibl.css",
28+
"inject": true
29+
},
30+
{
31+
"input": "src/assets/fonts/css/open-iconic-bootstrap.min.css",
32+
"inject": true
33+
},
2734
"src/styles.css"
2835
],
2936
"scripts": [
30-
// "node_modules/mathjax/MathJax.js",
31-
// "node_modules/mathjax/jax/output/SVG/config.js",
32-
// "node_modules/mathjax/extensions/MathMenu.js",
33-
// "node_modules/mathjax/extensions/MathZoom.js",
3437
"node_modules/plotly.js-dist/plotly.js"
35-
]
38+
],
39+
"vendorChunk": true,
40+
"extractLicenses": false,
41+
"buildOptimizer": false,
42+
"sourceMap": true,
43+
"optimization": false,
44+
"namedChunks": true
3645
},
3746
"configurations": {
3847
"production": {
@@ -45,21 +54,24 @@
4554
"optimization": true,
4655
"outputHashing": "all",
4756
"sourceMap": false,
48-
"extractCss": true,
4957
"namedChunks": false,
50-
"aot": true,
5158
"extractLicenses": true,
5259
"vendorChunk": false,
5360
"buildOptimizer": true,
5461
"budgets": [
5562
{
5663
"type": "initial",
5764
"maximumWarning": "2mb",
58-
"maximumError": "7mb"
65+
"maximumError": "10mb"
66+
},
67+
{
68+
"type": "anyComponentStyle",
69+
"maximumWarning": "6kb"
5970
}
6071
]
6172
}
62-
}
73+
},
74+
"defaultConfiguration": ""
6375
},
6476
"serve": {
6577
"builder": "@angular-devkit/build-angular:dev-server",

ibl-frontend/frontend-content/package.json

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,30 @@
1111
},
1212
"private": true,
1313
"dependencies": {
14-
"@angular/animations": "^7.1.4",
15-
"@angular/cdk": "^7.3.7",
16-
"@angular/common": "~7.1.0",
17-
"@angular/compiler": "~7.1.0",
18-
"@angular/core": "~7.1.0",
19-
"@angular/flex-layout": "^7.0.0-beta.24",
20-
"@angular/forms": "~7.1.0",
21-
"@angular/material": "^7.3.3",
22-
"@angular/material-moment-adapter": "^8.1.2",
23-
"@angular/platform-browser": "~7.1.0",
24-
"@angular/platform-browser-dynamic": "~7.1.0",
25-
"@angular/router": "~7.1.0",
26-
"@types/mathjax": "0.0.35",
14+
"@angular/animations": "^12.0.0",
15+
"@angular/cdk": "^12.0.0",
16+
"@angular/common": "^12.0.0",
17+
"@angular/compiler": "^12.0.0",
18+
"@angular/core": "^12.0.0",
19+
"@angular/flex-layout": "^12.0.0-beta.35",
20+
"@angular/forms": "^12.0.0",
21+
"@angular/material": "^12.0.0",
22+
"@angular/material-moment-adapter": "^12.0.0",
23+
"@angular/platform-browser": "^12.0.0",
24+
"@angular/platform-browser-dynamic": "^12.0.0",
25+
"@angular/router": "^12.0.0",
2726
"@wizpanda/super-gif": "0.0.5",
28-
"angular-plotly.js": "^1.3.2",
29-
"body-parser": "^1.18.3",
27+
"angular-plotly.js": "^4.0.4",
3028
"bootstrap": "^4.2.1",
31-
"core-js": "^2.5.4",
32-
"dotenv": "^8.0.0",
33-
"express": "^4.16.4",
34-
"jsonwebtoken": "^8.5.1",
35-
"mathjax": "^2.7.5",
36-
"moment": "^2.24.0",
37-
"plotly.js": "^1.49.0",
38-
"plotly.js-dist": "^1.44.4",
39-
"request": "^2.88.0",
40-
"rxjs": "~6.3.3",
41-
"rxjs-compat": "^6.3.3",
42-
"tslib": "^1.9.0",
43-
"zone.js": "~0.8.26"
29+
"moment": "^2.29.1",
30+
"plotly.js": "^2.5.1",
31+
"rxjs": "^7.4.0",
32+
"rxjs-compat": "^6.6.7",
33+
"zone.js": "^0.11.4"
4434
},
4535
"devDependencies": {
46-
"@angular-devkit/build-angular": "~0.11.0",
47-
"@angular/cli": "~7.1.3",
48-
"@angular/compiler-cli": "~7.1.0",
49-
"@angular/language-service": "~7.1.0",
50-
"@types/node": "~8.9.4",
51-
"@types/jasmine": "~2.8.8",
52-
"@types/jasminewd2": "~2.0.3",
53-
"codelyzer": "~4.5.0",
54-
"jasmine-core": "~2.99.1",
55-
"jasmine-spec-reporter": "~4.2.1",
56-
"karma": "~3.1.1",
57-
"karma-chrome-launcher": "~2.2.0",
58-
"karma-coverage-istanbul-reporter": "~2.0.1",
59-
"karma-jasmine": "~1.1.2",
60-
"karma-jasmine-html-reporter": "^0.2.2",
61-
"protractor": "~5.4.0",
62-
"ts-node": "~7.0.0",
63-
"tslint": "~5.11.0",
64-
"typescript": "~3.1.6"
36+
"@angular-devkit/build-angular": "^12.0.0",
37+
"@angular/cli": "^12.0.0",
38+
"@angular/compiler-cli": "^12.0.0"
6539
}
6640
}

ibl-frontend/frontend-content/src/app/app.module.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,28 @@ import { PlotlyModule } from 'angular-plotly.js';
66
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
77
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
88
import { Routes, RouterModule } from '@angular/router';
9-
import { MatSelectModule,
10-
MatAutocompleteModule,
11-
MatIconModule,
12-
MatInputModule,
13-
MatCheckboxModule,
14-
MatRadioModule,
15-
MatNativeDateModule,
16-
MatDatepickerModule,
17-
MatSlideToggleModule,
18-
MatCardModule,
19-
MatButtonModule,
20-
MatTableModule,
21-
MatPaginatorModule,
22-
MatSortModule,
23-
MatSliderModule,
24-
MatExpansionModule,
25-
MatDialogModule,
26-
MatTreeModule,
27-
MatFormFieldModule } from '@angular/material';
289
import { MatMomentDateModule, MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
10+
import { MatNativeDateModule } from '@angular/material/core';
2911
import { FlexLayoutModule } from '@angular/flex-layout';
3012
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
31-
32-
13+
import {MatSelectModule} from '@angular/material/select';
14+
import {MatAutocompleteModule} from '@angular/material/autocomplete';
15+
import {MatIconModule} from '@angular/material/icon';
16+
import {MatInputModule} from '@angular/material/input';
17+
import {MatCheckboxModule} from '@angular/material/checkbox';
18+
import {MatRadioModule} from '@angular/material/radio';
19+
import {MatDatepickerModule} from '@angular/material/datepicker';
20+
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
21+
import {MatCardModule} from '@angular/material/card';
22+
import {MatButtonModule} from '@angular/material/button';
23+
import {MatTableModule} from '@angular/material/table';
24+
import {MatPaginatorModule} from '@angular/material/paginator';
25+
import {MatSortModule} from '@angular/material/sort';
26+
import {MatSliderModule} from '@angular/material/slider';
27+
import {MatExpansionModule} from '@angular/material/expansion';
28+
import {MatDialogModule} from '@angular/material/dialog';
29+
import {MatTreeModule} from '@angular/material/tree';
30+
import {MatFormFieldModule} from '@angular/material/form-field';
3331
import { AuthGuard } from './auth/auth-guard.service';
3432
import { AppComponent } from './app.component';
3533
import { EachBatchComponent } from './each-batch/each-batch.component';
@@ -64,6 +62,7 @@ import { PsthPlotsComponent } from './cell-list/cell/psth-plots/psth-plots.compo
6462
import { QualityControlComponent } from './quality-control/quality-control.component';
6563
import { DriftmapComponent } from './quality-control/driftmap/driftmap.component';
6664
import { SpinningBrainComponent } from './mouse-list/mouse/spinning-brain/spinning-brain.component';
65+
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
6766

6867
PlotlyModule.plotlyjs = PlotlyJS;
6968

@@ -170,6 +169,7 @@ const appRoutes: Routes = [
170169
FormsModule,
171170
HttpClientModule,
172171
RouterModule.forRoot(appRoutes),
172+
MatProgressSpinnerModule,
173173
MatSelectModule, MatAutocompleteModule, MatIconModule, MatInputModule,
174174
MatCheckboxModule, MatRadioModule, MatNativeDateModule, MatDatepickerModule, MatMomentDateModule, MatSlideToggleModule,
175175
MatCardModule, MatButtonModule, MatTableModule, MatPaginatorModule, MatSortModule, MatSliderModule, MatExpansionModule,

ibl-frontend/frontend-content/src/app/auth/auth-guard.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router, CanActivateChild } from '@angular/router';
2-
import { Observable } from 'rxjs/Observable';
2+
import { Observable } from 'rxjs';
33
import { Injectable } from '@angular/core';
44
import { AuthService } from './auth.service';
55

0 commit comments

Comments
 (0)