9
9
import logging
10
10
log = logging .getLogger (__name__ )
11
11
12
-
13
12
import recastapi .request .read
14
13
import recastapi .analysis .read
15
14
import recastapi .response .write
16
15
17
- recast = Blueprint ('recast' , __name__ ,
18
- template_folder = 'recast_interface_templates' )
19
-
16
+ recast = Blueprint ('recast' , __name__ , template_folder = 'recast_interface_templates' )
20
17
21
18
@recast .route ('/request/<int:reqid>' )
22
19
def recast_request_view (reqid ):
@@ -26,26 +23,52 @@ def recast_request_view(reqid):
26
23
analysis_info = recastapi .analysis .read .analysis (analysis_id )
27
24
28
25
parpoints = recastapi .request .read .point_request_of_scan (reqid )
26
+ point_coordinates = {
27
+ p ['id' ]: {c ['title' ]:c ['value' ] for c in p ['point_coordinates' ]}
28
+ for p in parpoints
29
+ }
30
+
29
31
basic_req_data = {
30
- p ['id' ]: recastapi . request . read . basic_request_of_point ( p ['id' ])
32
+ p ['id' ]: p ['requests' ]
31
33
for p in parpoints
32
34
}
33
35
34
- wflow_config_labels = recastcatalogue ().get (int (analysis_id ), {}).keys ()
36
+
37
+ print recastcatalogue ()
38
+ wflow_configs = recastcatalogue ().get (int (analysis_id ), {})
39
+
40
+ print wflow_configs ,"HHUHUH"
35
41
processing_info = {}
36
42
for k , v in basic_req_data .iteritems ():
37
43
for basic_req in v :
38
- print 'basic_req' , basic_req
39
- processing_info [basic_req ['id' ]] = get_flattened_jobs (basic_req ['id' ], wflow_config_labels )
44
+ processing_info [basic_req ['id' ]] = get_flattened_jobs (basic_req ['id' ], wflow_configs .keys ())
45
+
46
+ visdata = {
47
+ 'data' : [
48
+ {
49
+ "values" : [],
50
+ "name" : "pointrequests"
51
+ }
52
+ ],
53
+ 'pars' : point_coordinates .values ()[0 ].keys ()
54
+ }
40
55
56
+ for i ,p in enumerate (parpoints ):
57
+ pd = {}
58
+ pd .update (global_pr_id = p ['id' ], scan_pr_id = i , ** point_coordinates [p ['id' ]])
59
+ visdata ['data' ][0 ]['values' ].append (pd )
60
+
41
61
log .info ('proc info is %s' , processing_info )
42
-
43
- return render_template ('recast_request.html' , request_info = request_info ,
44
- parpoints = enumerate (parpoints ),
45
- basic_req_data = basic_req_data ,
46
- analysis_info = analysis_info ,
47
- wflow_configs = wflow_config_labels ,
48
- processing_info = processing_info )
62
+ return render_template ('recast_request.html' ,
63
+ request_info = request_info ,
64
+ visdata = visdata ,
65
+ point_coordinates = point_coordinates ,
66
+ parpoints = enumerate (parpoints ),
67
+ basic_req_data = basic_req_data ,
68
+ analysis_info = analysis_info ,
69
+ wflow_configs = wflow_configs ,
70
+ processing_info = processing_info
71
+ )
49
72
50
73
51
74
@recast .route ('/wflowcatalgue' )
@@ -56,7 +79,8 @@ def recast_workflow_catalogue_view():
56
79
'implementations' : v .keys ()
57
80
} for anaid ,v in recastcatalogue ().iteritems ()
58
81
]
59
- return render_template ('recast_catalogue.html' , catalogue_info = catalogue_info )
82
+ return render_template ('recast_catalogue.html' ,
83
+ catalogue_info = catalogue_info )
60
84
61
85
62
86
@recast .route ('/requests' )
@@ -66,19 +90,16 @@ def recast_requests_view():
66
90
wflow_config_data = {}
67
91
68
92
full_configs = recastcatalogue ()
69
- print full_configs
70
93
for req in requests_info :
71
94
identifier = req ['analysis_id' ]
72
95
labels = [] if identifier not in full_configs else full_configs [identifier ].keys ()
73
96
wflow_config_data [req ['id' ]] = labels
74
97
75
- print wflow_config_data
76
98
return render_template ('recast_all_requests.html' ,
77
- requests_info = reversed (requests_info ),
78
- wflow_config_data = wflow_config_data
99
+ requests_info = reversed (requests_info ),
100
+ wflow_config_data = wflow_config_data
79
101
)
80
102
81
-
82
103
@recast .route ('/processBasicRequest' , methods = ['GET' ])
83
104
def process_request_point ():
84
105
wflowconfig = request .args ['wflowconfig' ]
@@ -90,14 +111,12 @@ def process_request_point():
90
111
log .info ('jobguid is: %s' , jobguid )
91
112
return jsonify (jobguid = jobguid )
92
113
93
-
94
114
def zipdir (path , zipfile ):
95
115
for root , dirs , files in os .walk (path ):
96
116
for fl in files :
97
117
zipfile .write (os .path .join (root , fl ), os .path .join (
98
118
root , fl ).split ('/' , 2 )[- 1 ])
99
119
100
-
101
120
def prepareupload (fullpath ):
102
121
stagingarea = '{}/stagingarea' .format (os .environ ['RECAST_STORAGEPATH' ])
103
122
if not os .path .exists (stagingarea ):
@@ -106,7 +125,6 @@ def prepareupload(fullpath):
106
125
zipdir (fullpath , zipfile .ZipFile (zipfilename , 'w' ))
107
126
return zipfilename
108
127
109
-
110
128
@recast .route ('/uploadPointResponse' )
111
129
def uploadresults ():
112
130
if not 'user' in session :
@@ -122,5 +140,5 @@ def uploadresults():
122
140
point_response = recastapi .response .write .point_response (
123
141
scan_response ['id' ], request .args ['pointreqid' ], resultdata )
124
142
recastapi .response .write .basic_response_with_archive (
125
- point_response ['id' ], request .args ['basicreqid' ], zipfilename , resultdata )
143
+ point_response ['id' ], request .args ['basicreqid' ], resultdata , request . args [ 'wflowconfig' ], zipfilename )
126
144
return jsonify (sucess = 'ok' , resultdata = resultdata )
0 commit comments