@@ -90,7 +90,40 @@ def execute(dir):
9090 resp .status_code = 500
9191 return resp
9292
93-
93+ # to download /build/<dir>?fetch=<graphml>. For example, /build/test?fetch=sample1
94+ @app .route ('/build/<dir>' , methods = ['POST' ])
95+ def build (dir ):
96+ graphml_file = request .args .get ('fetch' )
97+ makestudy_dir = dir + "/" + graphml_file #for makestudy
98+ cur_path = os .getcwd ()
99+ concore_path = os .path .abspath (os .path .join (cur_path , '../../' ))
100+ dir_path = os .path .abspath (os .path .join (concore_path , graphml_file )) #path for ./build
101+ if not os .path .exists (secure_filename (dir_path )):
102+ p1 = call (["./makestudy" , makestudy_dir ], cwd = concore_path )
103+ if (p1 == 0 ):
104+ resp = jsonify ({'message' : 'Directory successfully created' })
105+ resp .status_code = 201
106+ else :
107+ resp = jsonify ({'message' : 'There is an Error' })
108+ resp .status_code = 500
109+ call (["./build" ], cwd = dir_path )
110+ return resp
111+
112+
113+ @app .route ('/debug/<dir>' , methods = ['POST' ])
114+ def debug (dir ):
115+ cur_path = os .getcwd ()
116+ concore_path = os .path .abspath (os .path .join (cur_path , '../../' ))
117+ dir_path = os .path .abspath (os .path .join (concore_path , dir ))
118+ p1 = call (["./debug" ], cwd = dir_path )
119+ if (p1 == 0 ):
120+ resp = jsonify ({'message' : 'Close the pop window after obtaing result' })
121+ resp .status_code = 201
122+ return resp
123+ else :
124+ resp = jsonify ({'message' : 'There is an Error' })
125+ resp .status_code = 500
126+ return resp
94127
95128# to download /download/<dir>?fetch=<downloadfile>. For example, /download/test?fetch=example.py.out&apikey=xyz
96129@app .route ('/download/<dir>' , methods = ['POST' , 'GET' ])
@@ -112,5 +145,20 @@ def download(dir):
112145 return resp
113146
114147
148+ @app .route ('/destroy/<dir>' , methods = ['POST' ])
149+ def destroy (dir ):
150+ cur_path = os .getcwd ()
151+ concore_path = os .path .abspath (os .path .join (cur_path , '../../' ))
152+ p1 = call (["./destroy" , dir ], cwd = concore_path )
153+ if (p1 == 0 ):
154+ resp = jsonify ({'message' : 'Successfuly deleted Dirctory' })
155+ resp .status_code = 201
156+ return resp
157+ else :
158+ resp = jsonify ({'message' : 'There is an Error' })
159+ resp .status_code = 500
160+ return resp
161+
162+
115163if __name__ == "__main__" :
116164 app .run (host = "0.0.0.0" )
0 commit comments