Skip to content

Commit 36d5d68

Browse files
authored
Merge pull request #13 from amit-62/dev1
Added new changes
2 parents b31ffd5 + 9093e5d commit 36d5d68

3 files changed

Lines changed: 41 additions & 24 deletions

File tree

fri/server/main.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from subprocess import call
55
from pathlib import Path
6+
import json
67

78

89
app = Flask(__name__)
@@ -145,7 +146,7 @@ def download(dir):
145146
return resp
146147

147148

148-
@app.route('/destroy/<dir>', methods=['POST'])
149+
@app.route('/destroy/<dir>', methods=['DELETE'])
149150
def destroy(dir):
150151
cur_path = os.getcwd()
151152
concore_path = os.path.abspath(os.path.join(cur_path, '../../'))
@@ -157,7 +158,21 @@ def destroy(dir):
157158
else:
158159
resp = jsonify({'message': 'There is an Error'})
159160
resp.status_code = 500
160-
return resp
161+
return resp
162+
163+
@app.route('/getFilesList/<dir>', methods=['POST'])
164+
def getFilesList(dir):
165+
cur_path = os.getcwd()
166+
concore_path = os.path.abspath(os.path.join(cur_path, '../../'))
167+
dir_path = os.path.abspath(os.path.join(concore_path, dir))
168+
res = []
169+
170+
if(dir=='concore'):
171+
res = os.listdir(concore_path)
172+
else:
173+
res = os.listdir(dir_path)
174+
res2 = json.dumps(res)
175+
return res2
161176

162177

163178
if __name__ == "__main__":

fri/test.py

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,27 @@ def download():
4646
# function to check build
4747
def build():
4848
url = "http://127.0.0.1:5000/build/test?fetch=sample1"
49-
50-
payload={'': ''}
51-
files=[]
52-
headers = {}
53-
54-
response = requests.request("POST", url, headers=headers, data=payload, files=files)
55-
49+
response = requests.request("POST", url)
5650
print(response.text)
5751

5852
# function to debug
5953
def debug():
6054
url = "http://127.0.0.1:5000/debug/sample1"
61-
62-
payload={'': ''}
63-
files=[]
64-
headers = {}
65-
66-
response = requests.request("POST", url, headers=headers, data=payload, files=files)
67-
55+
response = requests.request("POST", url)
6856
print(response.text)
6957

7058

7159
#function to destroy dir.
7260
def destroy():
7361
url = "http://127.0.0.1:5000/destroy/sample1"
74-
75-
payload={'': ''}
76-
files=[]
77-
headers = {}
78-
79-
response = requests.request("POST", url, headers=headers, data=payload, files=files)
80-
62+
response = requests.request("DELETE", url)
63+
64+
print(response.text)
65+
66+
def getFilesList():
67+
import requests
68+
url = "http://127.0.0.1:5000/getFilesList/test"
69+
response = requests.request("POST", url)
8170
print(response.text)
8271

8372

@@ -87,4 +76,5 @@ def destroy():
8776
# build()
8877
# debug()
8978
# destroy()
79+
getFilesList()
9080

mkconcore.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,9 @@
595595
#remaining code deals only with posix or windows
596596

597597
#copy sourcefiles from ./src into corresponding directories
598+
if concoretype=="posix":
599+
fbuild.write('#!/bin/bash' + "\n")
600+
598601
for node in nodes_dict:
599602
containername,sourcecode = nodes_dict[node].split(':')
600603
if len(sourcecode)!=0:
@@ -678,6 +681,9 @@
678681
i=i+1
679682

680683
#start running source in associated dirs (run and debug scripts)
684+
if concoretype=="posix":
685+
fdebug.write('#!/bin/bash' + "\n")
686+
681687
i=0
682688
for node in nodes_dict:
683689
containername,sourcecode = nodes_dict[node].split(':')
@@ -769,7 +775,9 @@
769775
else:
770776
fdebug.write('concorewd=`pwd`\n')
771777
fdebug.write('osascript -e "tell application \\"Terminal\\" to do script \\"cd $concorewd/' +containername+";"+ MATLABEXE+' -batch run\\\\\\(\\\\\\'+"'"+sourcecode+"\\\\\\'"+'\\\\\\)\\""\n' )
772-
778+
779+
if concoretype=="posix":
780+
fstop.write('#!/bin/bash' + "\n")
773781
i=0 # 3/30/21
774782
for node in nodes_dict:
775783
containername,sourcecode = nodes_dict[node].split(':')
@@ -784,6 +792,8 @@
784792
i=i+1
785793
fstop.close()
786794

795+
if concoretype=="posix":
796+
fclear.write('#!/bin/bash' + "\n")
787797
i=0 # 9/13/21
788798
for node in nodes_dict:
789799
containername,sourcecode = nodes_dict[node].split(':')
@@ -799,6 +809,8 @@
799809
i=i+1
800810
fclear.close()
801811

812+
if concoretype=="posix":
813+
fmaxtime.write('#!/bin/bash' + "\n")
802814
i=0 # 9/12/21
803815
for node in nodes_dict:
804816
containername,sourcecode = nodes_dict[node].split(':')

0 commit comments

Comments
 (0)