-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
592 lines (584 loc) · 36.9 KB
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
import cherrypy
import os
class StringGenerator(object):
# Default behaviour
@cherrypy.expose
def index(self):
return "Hello World!"
# This method generates the data "on the fly" such that Galaxy can retrieve it immediately
# for synchronous communication
@cherrypy.expose
def generate(self, dataset, timesteps,
haloproperties='off',
haloparticles='off',
bighaloparticles='off',
simulationparticles='off', **params):
cherrypy.response.headers['Content-Type'] = 'text/plain'
hacc_user_selected_data = ['{"Model":"' + dataset + '"', ',', '"Timesteps":' + timesteps, ',',
'"Halo properties":"' + haloproperties + '"', ',',
'"Halo particles":"' + haloparticles + '"', ',',
'"Big halo particles":"' + bighaloparticles + '"', ',',
'"Simulation particles":"' + simulationparticles + '"', '}']
onestring = ''.join(hacc_user_selected_data)
print('Result: '+onestring)
return onestring
# The method necessary for the exchange of data with Galaxy synchronously
@cherrypy.expose
def getdata(self, sendToGalaxy=0, GALAXY_URL="", hgta_compressType="none", tool_id="none", hgta_outputType=""):
if int(sendToGalaxy) == 1:
return self.rendering_html_page(GALAXY_URL, tool_id)
else:
return "Just returning results. (GALAXY_URL: " + GALAXY_URL + ")"
def rendering_html_page(self, galaxy_url, tool_id):
htmlString = ("\n"
"<!DOCTYPE html>\n"
"<html>\n"
" <head>\n"
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"
" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/static/img/favicon.ico\" />\n"
" <link rel=\"icon\" type=\"image/x-icon\" href=\"/static/img/favicon.ico\" />\n"
"\n"
" <title>HACC Simulation Data Portal - Transfer</title>\n"
"\n"
" \n"
" <link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/bootstrap.min.css\" />\n"
" <link rel=\"stylesheet\" type=\"text/css\" href=\"/static/css/style.css\" />\n"
"\n"
" \n"
" <link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\" rel=\"stylesheet\" type=\"text/css\">\n"
" <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>\n"
"\n"
" \n"
" <script type=\"text/javascript\" src=\"/static/js/jquery.min.js\"></script>\n"
" <script type=\"text/javascript\" src=\"/static/js/bootstrap.min.js\"></script>\n"
" </head>\n"
" <body>\n"
" <nav class=\"navbar navbar-default navbar-custom navbar-fixed-top\">\n"
" <div class=\"container-fluid\">\n"
" <!-- Brand and toggle get grouped for better mobile display -->\n"
" <div class=\"navbar-header page-scroll\">\n"
" <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\">\n"
" <span class=\"sr-only\">Toggle navigation</span>\n"
" <span class=\"icon-bar\"></span>\n"
" <span class=\"icon-bar\"></span>\n"
" <span class=\"icon-bar\"></span>\n"
" </button>\n"
" <a class=\"navbar-brand\" href=\"/\">Home</a>\n"
" <a class=\"navbar-brand\" href=\"/transfer/miratitan\">MiraTitan</a>\n"
" <a class=\"navbar-brand\" href=\"/outerrim\">OuterRim</a>\n"
" <a class=\"navbar-brand\" href=\"/transfer/qcontinuum\">QContinuum</a>\n"
" </div>\n"
"\n"
" <!-- Collect the nav links, forms, and other content for toggling -->\n"
" <!--<div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\n"
" <ul class=\"nav navbar-nav navbar-right\">\n"
" <li>\n"
" <a href=\"/faq\">FAQ</a>\n"
" </li>\n"
" <li class=\"divider\">|</li> -->\n"
" <!-- Display these links only is user is authenticated -->\n"
" <!-- Change the condition below to an actual test -->\n"
" <!--\n"
" <li>\n"
" <a href=\"/logout\">Logout</a>\n"
" </li>\n"
" <li class=\"divider\">|</li>\n"
"\n"
" <li>\n"
" <a href=\"/profile\">[email protected]</a>\n"
" </li> -->\n"
" <!-- Display these links if user is not authenticated -->\n"
" <!--\n"
" </ul>\n"
" </div> --> <!-- /.navbar-collapse -->\n"
" </div> <!-- /.container-fluid -->\n"
" </nav>\n"
"\n"
" <!-- Page body -->\n"
" \n"
" <!-- Page Header -->\n"
"<!-- Set background image for this header on the line below. -->\n"
"<header class=\"intro-header\" style=\"background-image: url(/static/img/menu-bg.jpg)\">\n"
" <div class=\"container\">\n"
" <div class=\"row\">\n"
" <div class=\"col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1\">\n"
" <h1> </h1>\n"
" </div>\n"
" </div>\n"
" </div>\n"
"</header>\n"
"\n"
"\n"
" \n"
"\n"
" <link rel=\"stylesheet\" type=\"text/css\" href=\"/static/datatables/datatables.min.css\"/>\n"
" <link rel=\"stylesheet\" type=\"text/css\" href=\"/static/datatables/Select-1.2.4/css/select.dataTables.min.css\"/>\n"
" <link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css\">\n"
"\n"
" <script type=\"text/javascript\" src=\"/static/datatables/datatables.min.js\"></script>\n"
" <script type=\"text/javascript\" src=\"/static/datatables/Select-1.2.4/js/dataTables.select.min.js\"></script>\n"
"\n"
" <link rel=\"stylesheet\" href=\"/static/js/chosen/docsupport/prism.css\"/>\n"
" <link rel=\"stylesheet\" href=\"/static/js/chosen/chosen.css\"/>\n"
" <script type=\"text/javascript\" src=\"/static/js/chosen/chosen.jquery.js\"></script>\n"
" <script src=\"https://code.jquery.com/ui/1.12.1/jquery-ui.js\"></script>\n"
"\n"
" <style>\n"
".column {\n"
" float: left;\n"
" width: 30%;\n"
" padding: 20px;\n"
"}\n"
"\n"
"/* Clear floats after the columns */\n"
".row:after {\n"
" content: \"\";\n"
" display: table;\n"
" clear: both;\n"
"}\n"
" </style>\n"
"\n"
" <div class=\"container\">\n"
"\n"
" <div class=\"page-header\">\n"
" <h1>Data from MiraTitanU Snapshots</h1>\n"
" </div>\n"
"\n"
" The Mira-Titan Universe simulation suite was carried out on Mira, a supercomputer at the Argonne Leadership Facility, and Titan, at the Oak Ridge National Laboratory. The simulations cover a range of cosmological models including models with a dynamical dark energy equation of state parameterized via w<sub>0</sub> and w<sub>a</sub>. Each simulation covers a (2.1Gpc)<sup>3</sup> volume and evolves 3200<sup>3</sup> particles. We provide outputs for 27 redshifts, between z=4 and z=0, including halo information and down-sampled particle information.\n"
"\n"
"<br><br>\n"
"\n"
"Please select one or more models from the list below, then select all the relevant redshifts and data products. The SubmitTransfer button will indicate the number and overall size of the selected files that you aim to transfer. This button will lead you to the Globus interface. The Search box at the top allows you to narrow the model selection by specifying a model number or a numerical value for any cosmological parameter.\n"
"\n"
"<br><br>\n"
"\n"
" <div class=\"form-wrapper\">\n"
" \n")
htmlString += " <form class=\"form-inline\" id=\"transfer_form\" role=\"form\" action=\"" + galaxy_url +"\" method=\"post\">\n"
htmlString += (
" \n"
" <div class=\"row\">\n"
" <div class=\"col-md-12\">\n"
" <table id=\"datasets\" class=\"display\" cellspacing=\"0\" width=\"100%\">\n"
" <thead>\n"
" <tr>\n"
" <th></th>\n"
" <th>Model</th>\n"
" <th>Ω<sub>cdm</sub></th>\n"
" <th>ω<sub>b</sub></th>\n"
" <th>ω<sub>ν</sub></th>\n"
" <th>h</th>\n"
" <th>σ<sub>8</sub></th>\n"
" <th>n<sub>s</sub></th>\n"
" <th>w<sub>0</sub></th>\n"
" <th>w<sub>a</sub></th>\n"
" </tr>\n"
" </thead>\n"
" <tbody>\n"
" \n"
" <tr name=\"M000\">\n"
" <td></td>\n"
" <td>M000 </td>\n"
" <td>0.2200 </td>\n"
" <td>0.02258 </td>\n"
" <td>0.0 </td>\n"
" <td>0.7100 </td>\n"
" <td>0.8000 </td>\n"
" <td>0.9630 </td>\n"
" <td>-1.0000 </td>\n"
" <td>0.0000 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M001\">\n"
" <td></td>\n"
" <td>M001 </td>\n"
" <td>0.3276 </td>\n"
" <td>0.02261 </td>\n"
" <td>0.0 </td>\n"
" <td>0.6167 </td>\n"
" <td>0.8778 </td>\n"
" <td>0.9611 </td>\n"
" <td>-0.7000 </td>\n"
" <td>0.6722 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M002\">\n"
" <td></td>\n"
" <td>M002 </td>\n"
" <td>0.1997 </td>\n"
" <td>0.02328 </td>\n"
" <td>0.0 </td>\n"
" <td>0.7500 </td>\n"
" <td>0.8556 </td>\n"
" <td>1.0500 </td>\n"
" <td>-1.0330 </td>\n"
" <td>0.9111 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M003\">\n"
" <td></td>\n"
" <td>M003 </td>\n"
" <td>0.2590 </td>\n"
" <td>0.02194 </td>\n"
" <td>0.0 </td>\n"
" <td>0.7167 </td>\n"
" <td>0.9000 </td>\n"
" <td>0.8944 </td>\n"
" <td>-1.1000 </td>\n"
" <td>-0.2833 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M004\">\n"
" <td></td>\n"
" <td>M004 </td>\n"
" <td>0.2971 </td>\n"
" <td>0.02283 </td>\n"
" <td>0.0 </td>\n"
" <td>0.5833 </td>\n"
" <td>0.7889 </td>\n"
" <td>0.8722 </td>\n"
" <td>-1.1670 </td>\n"
" <td>1.1500 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M005\">\n"
" <td></td>\n"
" <td>M005 </td>\n"
" <td>0.1658 </td>\n"
" <td>0.02350 </td>\n"
" <td>0.0 </td>\n"
" <td>0.8500 </td>\n"
" <td>0.7667 </td>\n"
" <td>0.9833 </td>\n"
" <td>-1.2330 </td>\n"
" <td>-0.0445 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M006\">\n"
" <td></td>\n"
" <td>M006 </td>\n"
" <td>0.3643 </td>\n"
" <td>0.02150 </td>\n"
" <td>0.0 </td>\n"
" <td>0.5500 </td>\n"
" <td>0.8333 </td>\n"
" <td>0.9167 </td>\n"
" <td>-0.7667 </td>\n"
" <td>0.1944 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M007\">\n"
" <td></td>\n"
" <td>M007 </td>\n"
" <td>0.1933 </td>\n"
" <td>0.02217 </td>\n"
" <td>0.0 </td>\n"
" <td>0.8167 </td>\n"
" <td>0.8111 </td>\n"
" <td>1.0280 </td>\n"
" <td>-0.8333 </td>\n"
" <td>-1.0000 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M008\">\n"
" <td></td>\n"
" <td>M008 </td>\n"
" <td>0.2076 </td>\n"
" <td>0.02306 </td>\n"
" <td>0.0 </td>\n"
" <td>0.6833 </td>\n"
" <td>0.7000 </td>\n"
" <td>1.0060 </td>\n"
" <td>-0.9000 </td>\n"
" <td>0.4333 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M009\">\n"
" <td></td>\n"
" <td>M009 </td>\n"
" <td>0.2785 </td>\n"
" <td>0.02172 </td>\n"
" <td>0.0 </td>\n"
" <td>0.6500 </td>\n"
" <td>0.7444 </td>\n"
" <td>0.8500 </td>\n"
" <td>-0.9667 </td>\n"
" <td>-0.7611 </td>\n"
" </tr>\n"
" \n"
" <tr name=\"M010\">\n"
" <td></td>\n"
" <td>M010 </td>\n"
" <td>0.1718 </td>\n"
" <td>0.02239 </td>\n"
" <td>0.0 </td>\n"
" <td>0.7833 </td>\n"
" <td>0.7222 </td>\n"
" <td>0.9389 </td>\n"
" <td>-1.3000 </td>\n"
" <td>-0.5222 </td>\n"
" </tr>\n"
" \n"
"\n"
" </tbody>\n"
" </table>\n"
"\n"
" </div>\n"
" </div>\n"
" <input id=\"dataset\" name=\"dataset\" type=\"hidden\" value=\"XXX\">\n"
"\n"
" <hr>\n"
"\n"
"\n"
"<div class=\"row\">\n"
" <div class=\"column\" style=\"width:25%\">\n"
" <fieldset>\n"
" <legend>Redshift values</legend>\n"
" <select id=\"redshift_select\" name=\"timesteps\" form=\"transfer_form\" data-placeholder=\"Choose redshift value(s)...\" multiple class=\"select\" tabindex=\"1\">\n"
" \n"
" <option value=\"\"></option>\n"
" <option value=\"97\" redshift_value=\"4.000000\">4.000000</option><option value=\"121\" redshift_value=\"3.036145\">3.036145</option><option value=\"141\" redshift_value=\"2.477509\">2.477509</option><option value=\"163\" redshift_value=\"2.018018\">2.018018</option><option value=\"176\" redshift_value=\"1.799443\">1.799443</option><option value=\"189\" redshift_value=\"1.610390\">1.610390</option><option value=\"208\" redshift_value=\"1.375887\">1.375887</option><option value=\"224\" redshift_value=\"1.208791\">1.208791</option><option value=\"247\" redshift_value=\"1.005988\">1.005988</option><option value=\"279\" redshift_value=\"0.778761\">0.778761</option><option value=\"286\" redshift_value=\"0.735751\">0.735751</option><option value=\"293\" redshift_value=\"0.694772\">0.694772</option><option value=\"300\" redshift_value=\"0.655684\">0.655684</option><option value=\"307\" redshift_value=\"0.618357\">0.618357</option><option value=\"315\" redshift_value=\"0.577708\">0.577708</option><option value=\"323\" redshift_value=\"0.539051\">0.539051</option><option value=\"331\" redshift_value=\"0.502242\">0.502242</option><option value=\"338\" redshift_value=\"0.471449\">0.471449</option><option value=\"347\" redshift_value=\"0.433666\">0.433666</option><option value=\"355\" redshift_value=\"0.401674\">0.401674</option><option value=\"365\" redshift_value=\"0.363636\">0.363636</option><option value=\"382\" redshift_value=\"0.303502\">0.303502</option><option value=\"401\" redshift_value=\"0.242274\">0.242274</option><option value=\"411\" redshift_value=\"0.212304\">0.212304</option><option value=\"432\" redshift_value=\"0.153846\">0.153846</option><option value=\"453\" redshift_value=\"0.100767\">0.100767</option><option value=\"499\" redshift_value=\"0.000000\">0.000000</option>\n"
" \n"
" </select>\n"
" </fieldset>\n"
" </div>\n"
" <div class=\"column\" style=\"width:45%\">\n"
" <fieldset>\n"
" <legend>Data Types to Download</legend>\n"
" \n"
" <label style=\"width:85%\" for=\"haloproperties\">FOF halo properties</label>\n"
" <input type=\"checkbox\" name=\"haloproperties\" id=\"haloproperties\" checked=\"true\" >\n"
" <span class=\"ui-icon ui-icon-info\" title=\"Includes FOF halo centers, velocity, mass, etc.\"></span>\n"
" <br>\n"
" <label style=\"width:85%\" for=\"haloparticles\">Halo particles (downsampled)</label>\n"
" <input type=\"checkbox\" name=\"haloparticles\" id=\"haloparticles\">\n"
" <span class=\"ui-icon ui-icon-info\" title=\"Includes downsampled halo particle positions and velocities\"></span>\n"
" <br>\n"
" <label style=\"width:85%\" for=\"bighaloparticles\">Halo particles (full)</label>\n"
" <input type=\"checkbox\" name=\"bighaloparticles\" id=\"bighaloparticles\">\n"
" <span class=\"ui-icon ui-icon-info\" title=\"Includes halo particle positions and velocities\"></span>\n"
" <br>\n"
" <label style=\"width:85%\" for=\"simulationparticles\" >Simulation particles (downsampled)</label>\n"
" <input type=\"checkbox\" name=\"simulationparticles\" id=\"simulationparticles\" >\n"
" <span class=\"ui-icon ui-icon-info\" title=\"Includes simulation particle positions and velocities\"></span>\n"
" <br>\n"
" \n"
" \n"
" \n"
" </fieldset>\n"
" </div>\n"
" <div class=\"column\">\n"
" <legend>Submit Transfer</legend>\n"
" <div class=\"form-actions\">\n")
htmlString += "<input type=\"HIDDEN\" value=\"" + tool_id + "\" name=\"tool_id\">\n"
htmlString += ("<input type=\"HIDDEN\" value=\"txt\" name=\"outputType\">\n"
"<input type=\"HIDDEN\" value=\"http://localhost:8090/generate\" name=\"URL\">\n"
" <input name=\"transfer\" id=\"transfer_button\" type=\"submit\" class=\"btn btn-primary\"\n"
" value=\"Send result to galaxy!\">\n"
" <br>\n")
htmlString += (
" <small>Sending results to Galaxy at: \"" + galaxy_url + "\"</small>\n"
" <br>\n"
" <small>After selecting model(s), redshift, and data types, you can select the destination for these files on the next page.</small>\n"
"\n"
" </div>\n"
" </div>\n"
"\n"
"</div>\n"
"\n"
" </form>\n"
" </div> <!-- form -->\n"
"\n"
" </div> <!-- container -->\n"
"\n"
" <script>\n"
"\n"
" function formatBytes(a,b){if(0==a)return\"0 Bytes\";var c=1024,d=b||2,e=[\"Bytes\",\"KB\",\"MB\",\"GB\",\"TB\",\"PB\",\"EB\",\"ZB\",\"YB\"],f=Math.floor(Math.log(a)/Math.log(c));return parseFloat((a/Math.pow(c,f)).toFixed(d))+\" \"+e[f]}\n"
"\n"
" function updateTransferSize() {\n"
" var selected_rows = datasets_table.rows({ selected: true });\n"
" var simulation = \"MiraTitanU\";\n"
" var data = datasets_table.rows({selected: true}).data();\n"
" var models=[]; \n"
" for (var i=0; i < data.length ;i++){\n"
" models.push(data[i][1]);\n"
" }\n"
"\n"
"\n"
" \n"
" var timesteps = $(\"#redshift_select\").val();\n"
"\n"
" if( models.length > 0 && timesteps.length > 0 )\n"
" {\n"
" $(\"#transfer_button\").prop('disabled', false);\n"
" }\n"
" else\n"
" {\n"
" $(\"#transfer_button\").prop('disabled', true);\n"
" $(\"#transfer_button\").prop('value',\"Select Models to Transfer\");\n"
" return;\n"
" }\n"
"\n"
" $('#dataset').prop('value',models);\n"
"\n"
" var haloparticles = $(\"#haloparticles\").is(':checked');\n"
" var bighaloparticles = $(\"#bighaloparticles\").is(':checked');\n"
" var haloproperties = $(\"#haloproperties\").is(':checked');\n"
" var simulationparticles = $(\"#simulationparticles\").is(':checked');\n"
"\n"
" numfiles=0\n"
" numbytes=0\n"
" $.each( timesteps, function(i) {\n"
" $.each( models, function(mi) {\n"
" ts=$(timesteps[i]).prop(\"timestep\");\n"
" m=models[mi];\n"
" d = sizedata[simulation][m][timesteps[i]];\n"
" if(haloparticles) { numfiles += d['haloparticles']['numfiles'] ; numbytes += d['haloparticles']['bytes']; }\n"
" if(bighaloparticles) { numfiles += d['bighaloparticles']['numfiles'] ; numbytes += d['bighaloparticles']['bytes']; }\n"
" if(haloproperties) { numfiles += d['fofproperties']['numfiles'] ; numbytes += d['fofproperties']['bytes']; }\n"
" if(simulationparticles) { numfiles += d['mpicosmo']['numfiles'] ; numbytes += d['mpicosmo']['bytes']; }\n"
" });\n"
" });\n"
" console.log(\"numfiles: \" + numfiles);\n"
" console.log(\"numbytes: \" + numbytes);\n"
"\n"
" $(\"#transfer_button\").prop('value',\"Transfer \" + numfiles + \" files (\" + formatBytes(numbytes) + \")\");\n"
"\n"
"\n"
" return false;\n"
" }\n"
"\n"
"\n"
" var sizedata=null;\n"
" var datasets_table;\n"
" $(document).ready(function() {\n"
" console.log(\"ready\");\n"
" $(\"#transfer_button\").prop('disabled', true);\n"
"\n"
" datasets_table = $('#datasets').DataTable( {\n"
" paging: false, \n"
" columnDefs: [ {\n"
" targets: 0,\n"
" orderable: false,\n"
" className: 'select-checkbox',\n"
"\n"
" },\n"
" { className: \"dt-right\", \"targets\": [ 2, 3, 4, 5, 6, 7, 8, 9 ] }\n"
" ],\n"
" select: {\n"
" \n"
" style: 'multi',\n"
" \n"
" selector: 'td:first-child',\n"
" },\n"
" order: [[ 1, 'asc' ]],\n"
" info: false,\n"
" } );\n"
"\n"
" \n"
"\n"
"\n"
" datasets_table\n"
" .on( 'select', function ( e, dt, type, indexes ) {\n"
" updateTransferSize();\n"
" } )\n"
" .on( 'deselect', function ( e, dt, type, indexes ) {\n"
" updateTransferSize();\n"
" } );\n"
"\n"
" $(\"#redshift_select\").chosen();\n"
" $( \"#haloproperties\" ).checkboxradio();\n"
" $( \"#haloparticles\" ).checkboxradio();\n"
" $( \"#bighaloparticles\" ).checkboxradio();\n"
" $( \"#simulationparticles\" ).checkboxradio();\n"
"\n"
"\n"
" $.getJSON( \"/static/data.json\", function( json ) {\n"
" sizedata=json;\n"
" console.log( \"JSON Data: \" + json );\n"
" console.log( \"JSON Data: \" + json['MiraTitanU']['M001']['499']['haloparticles']['bytes'] );\n"
" console.log( \"JSON Data: \" + json['OuterRim']['M000']['499']['fofproperties']['bytes'] );\n"
" });\n"
"\n"
" console.log(\"test\")\n"
" console.log($('transfer').value)\n"
" $('#transfer_form #transfer,#haloparticles,#haloproperties,#bighaloparticles,#simulationparticles,#redshift_select').change( \n"
" function() { updateTransferSize(); }\n"
" );\n"
"\n"
" $( function() {\n"
" $( document ).tooltip();\n"
" } );\n"
"\n"
"$( \"img\" ).hover(\n"
" function() {\n"
" $( this ).addClass( \"hover\" );\n"
" }, function() {\n"
" $( this ).removeClass( \"hover\" );\n"
" }\n"
");\n"
"\n"
" } );\n"
" </script>\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" <!-- Page footer -->\n"
" <!-- Footer -->\n"
"<footer>\n"
" <div class=\"container\">\n"
" \n"
" </div>\n"
"</footer>\n"
"\n"
"<script type=\"text/javascript\">\n"
"// Navigation Scripts to Show Header on Scroll-Up\n"
"jQuery(document).ready(function($) {\n"
" var MQL = 1170;\n"
"\n"
" //primary navigation slide-in effect\n"
" if ($(window).width() > MQL) {\n"
" var headerHeight = $('.navbar-custom').height();\n"
" $(window).on('scroll', {previousTop: 0},\n"
" function() {\n"
" var currentTop = $(window).scrollTop();\n"
" //check if user is scrolling up\n"
" if (currentTop < this.previousTop) {\n"
" //if scrolling up...\n"
" if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) {\n"
" $('.navbar-custom').addClass('is-visible');\n"
" } else {\n"
" $('.navbar-custom').removeClass('is-visible is-fixed');\n"
" }\n"
" } else {\n"
" //if scrolling down...\n"
" $('.navbar-custom').removeClass('is-visible');\n"
" if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed');\n"
" }\n"
" this.previousTop = currentTop;\n"
" });\n"
" }\n"
"});\n"
"</script>\n"
"\n"
" </body>\n"
"</html>\n")
return htmlString
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.staticdir.root': os.path.abspath(os.getcwd())
},
'/static': {
'tools.staticdir.on': True,
'tools.staticdir.dir': './public'
}
}
cherrypy.config.update({'server.socket_host': '0.0.0.0',
'server.socket_port': 8090})
cherrypy.quickstart(StringGenerator(), '/', conf)