@@ -55,6 +55,7 @@ class InvalidPOSTRequest(Exception):
55
55
56
56
gAnalysisSessions = sessionManager .sessionManager ()
57
57
gStartTime = time .time ()
58
+ gDataLocation = mosaic .WebServerDataLocation
58
59
59
60
@app .route ("/" )
60
61
def index ():
@@ -97,29 +98,31 @@ def processingAlgorithm():
97
98
@gzipped
98
99
@registerLaunch ("new_analysis_mweb" )
99
100
def newAnalysis ():
100
- global gAnalysisSessions
101
+ global gAnalysisSessions , gDataLocation
101
102
# logger=mlog.mosaicLogging().getLogger(name=__name__)
102
103
103
104
try :
104
105
defaultSettings = False
105
106
params = dict (request .get_json ())
106
107
107
108
dataPath = params .get ('dataPath' , None )
109
+ dataFilter = params .get ('dataFilter' , False )
108
110
settingsString = params .get ('settingsString' , None )
109
111
sessionID = params .get ('sessionID' , None )
110
112
111
113
if dataPath and not settingsString : # brand new session
112
114
# print "brand new session: ", dataPath, settingsString, sessionID
113
- logger .info ("/new-analysis: " + format_path (mosaic . WebServerDataLocation + '/' + dataPath ))
115
+ logger .info ("/new-analysis: " + format_path (gDataLocation + '/' + dataPath ))
114
116
115
117
sessionID = gAnalysisSessions .newSession ()
116
- ma = mosaicAnalysis .mosaicAnalysis ( format_path (mosaic . WebServerDataLocation + '/' + dataPath ), sessionID )
118
+ ma = mosaicAnalysis .mosaicAnalysis ( format_path (gDataLocation + '/' + dataPath ), sessionID , dataFilter = dataFilter )
117
119
118
- gAnalysisSessions .addDataPath (sessionID , format_path (mosaic . WebServerDataLocation + '/' + dataPath ) )
120
+ gAnalysisSessions .addDataPath (sessionID , format_path (gDataLocation + '/' + dataPath ) )
119
121
gAnalysisSessions .addMOSAICAnalysisObject (sessionID , ma )
120
122
elif sessionID and settingsString : # update settings
121
123
# print "update settings: ", dataPath, settingsString, sessionID
122
124
ma = gAnalysisSessions .getSessionAttribute (sessionID , 'mosaicAnalysisObject' )
125
+ ma .dataFilter = dataFilter
123
126
ma .updateSettings (settingsString )
124
127
125
128
gAnalysisSessions .addSettingsString (sessionID , ma .analysisSettingsDict )
@@ -147,13 +150,13 @@ def newAnalysis():
147
150
@gzipped
148
151
@registerLaunch ("load_analysis_mweb" )
149
152
def loadAnalysis ():
150
- global gAnalysisSessions
153
+ global gAnalysisSessions , gDataLocation
151
154
152
155
try :
153
156
params = dict (request .get_json ())
154
157
db = params .get ('databaseFile' , None )
155
158
156
- databaseFile = format_path (mosaic . WebServerDataLocation + '/' + db )
159
+ databaseFile = format_path (gDataLocation + '/' + db )
157
160
if not databaseFile :
158
161
raise InvalidPOSTRequest ("Missing required parameter 'databaseFile'" )
159
162
@@ -307,15 +310,15 @@ def analysisStats():
307
310
308
311
@app .route ('/analysis-log' , methods = ['POST' ])
309
312
def analysisLog ():
310
- global gAnalysisSessions
313
+ global gAnalysisSessions , gDataLocation
311
314
312
315
try :
313
316
params = dict (request .get_json ())
314
317
315
318
sessionID = params ['sessionID' ]
316
319
dbfile = gAnalysisSessions .getSessionAttribute (sessionID , 'databaseFile' )
317
320
318
- logstr = (rawQuery (dbfile , "select logstring from analysislog" )[0 ][0 ]).replace (str (mosaic . WebServerDataLocation ), "<Data Root>" )
321
+ logstr = (rawQuery (dbfile , "select logstring from analysislog" )[0 ][0 ]).replace (str (gDataLocation ), "<Data Root>" )
319
322
320
323
return jsonify (respondingURL = 'analysis-log' , logText = logstr ), 200
321
324
except (sessionManager .SessionNotFoundError , KeyError ):
@@ -374,16 +377,16 @@ def pollAnalysisStatus():
374
377
375
378
@app .route ('/list-data-folders' , methods = ['POST' ])
376
379
def listDataFolders ():
377
- # logger=mlog.mosaicLogging().getLogger(name=__name__)
380
+ global gDataLocation
378
381
379
382
params = dict (request .get_json ())
380
383
381
384
level = params .get ('level' , 'Data Root' )
382
385
if level == 'Data Root' :
383
- folder = mosaic . WebServerDataLocation
386
+ folder = gDataLocation
384
387
logger .info ("/list-data-folders: " + folder )
385
388
else :
386
- folder = format_path (mosaic . WebServerDataLocation + '/' + level + '/' )
389
+ folder = format_path (gDataLocation + '/' + level + '/' )
387
390
logger .info ("/list-data-folders: " + folder )
388
391
389
392
@@ -393,7 +396,7 @@ def listDataFolders():
393
396
itemAttr = {}
394
397
if os .path .isdir (item ):
395
398
itemAttr ['name' ]= os .path .relpath (item , folder )
396
- itemAttr ['relpath' ]= os .path .relpath (item , format_path (mosaic . WebServerDataLocation ) )
399
+ itemAttr ['relpath' ]= os .path .relpath (item , format_path (gDataLocation ) )
397
400
itemAttr ['desc' ]= _folderDesc (item )
398
401
itemAttr ['modified' ]= time .strftime ('%m/%d/%Y, %I:%M %p' , time .localtime (os .path .getmtime (item )))
399
402
@@ -403,15 +406,17 @@ def listDataFolders():
403
406
404
407
@app .route ('/list-database-files' , methods = ['POST' ])
405
408
def listDatabaseFiles ():
409
+ global gDataLocation
410
+
406
411
params = dict (request .get_json ())
407
412
408
413
level = params .get ('level' , 'Data Root' )
409
414
logger .info ("/list-database-files: " + str (level ))
410
415
if level == 'Data Root' :
411
- folder = mosaic . WebServerDataLocation
416
+ folder = gDataLocation
412
417
logger .info ("/list-database-files: " + folder )
413
418
else :
414
- folder = format_path (mosaic . WebServerDataLocation + '/' + level + '/' )
419
+ folder = format_path (gDataLocation + '/' + level + '/' )
415
420
logger .info ("/list-database-files: " + folder )
416
421
417
422
fileList = []
@@ -420,15 +425,15 @@ def listDatabaseFiles():
420
425
itemAttr = {}
421
426
if os .path .isdir (item ):
422
427
itemAttr ['name' ]= os .path .relpath (item , folder )
423
- itemAttr ['relpath' ]= os .path .relpath (item , format_path (mosaic . WebServerDataLocation ) )
428
+ itemAttr ['relpath' ]= os .path .relpath (item , format_path (gDataLocation ) )
424
429
itemAttr ['desc' ]= _folderDesc (item )
425
430
itemAttr ['modified' ]= time .strftime ('%m/%d/%Y, %I:%M %p' , time .localtime (os .path .getmtime (item )))
426
431
427
432
fileList .append (itemAttr )
428
433
else :
429
434
if _fileExtension (item )== ".sqlite" :
430
435
itemAttr ['name' ]= os .path .relpath (item , folder )
431
- itemAttr ['relpath' ]= os .path .relpath (item , format_path (mosaic . WebServerDataLocation ) )
436
+ itemAttr ['relpath' ]= os .path .relpath (item , format_path (gDataLocation ) )
432
437
itemAttr ['desc' ]= "SQLite database, {0}" .format (_fileSize (item ))
433
438
itemAttr ['modified' ]= time .strftime ('%m/%d/%Y, %I:%M %p' , time .localtime (os .path .getmtime (item )))
434
439
0 commit comments