Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions fri/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from subprocess import call
from pathlib import Path
import json


app = Flask(__name__)
Expand Down Expand Up @@ -145,7 +146,7 @@ def download(dir):
return resp


@app.route('/destroy/<dir>', methods=['POST'])
@app.route('/destroy/<dir>', methods=['DELETE'])
def destroy(dir):
cur_path = os.getcwd()
concore_path = os.path.abspath(os.path.join(cur_path, '../../'))
Expand All @@ -157,7 +158,21 @@ def destroy(dir):
else:
resp = jsonify({'message': 'There is an Error'})
resp.status_code = 500
return resp
return resp

@app.route('/getFilesList/<dir>', methods=['POST'])
def getFilesList(dir):
cur_path = os.getcwd()
concore_path = os.path.abspath(os.path.join(cur_path, '../../'))
dir_path = os.path.abspath(os.path.join(concore_path, dir))
res = []

if(dir=='concore'):
res = os.listdir(concore_path)
else:
res = os.listdir(dir_path)
res2 = json.dumps(res)
return res2


if __name__ == "__main__":
Expand Down
32 changes: 11 additions & 21 deletions fri/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,27 @@ def download():
# function to check build
def build():
url = "http://127.0.0.1:5000/build/test?fetch=sample1"

payload={'': ''}
files=[]
headers = {}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

response = requests.request("POST", url)
print(response.text)

# function to debug
def debug():
url = "http://127.0.0.1:5000/debug/sample1"

payload={'': ''}
files=[]
headers = {}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

response = requests.request("POST", url)
print(response.text)


#function to destroy dir.
def destroy():
url = "http://127.0.0.1:5000/destroy/sample1"

payload={'': ''}
files=[]
headers = {}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

response = requests.request("DELETE", url)

print(response.text)

def getFilesList():
import requests
url = "http://127.0.0.1:5000/getFilesList/test"
response = requests.request("POST", url)
print(response.text)


Expand All @@ -87,4 +76,5 @@ def destroy():
# build()
# debug()
# destroy()
getFilesList()

14 changes: 13 additions & 1 deletion mkconcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@
#remaining code deals only with posix or windows

#copy sourcefiles from ./src into corresponding directories
if concoretype=="posix":
fbuild.write('#!/bin/bash' + "\n")

for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
if len(sourcecode)!=0:
Expand Down Expand Up @@ -678,6 +681,9 @@
i=i+1

#start running source in associated dirs (run and debug scripts)
if concoretype=="posix":
fdebug.write('#!/bin/bash' + "\n")

i=0
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
Expand Down Expand Up @@ -769,7 +775,9 @@
else:
fdebug.write('concorewd=`pwd`\n')
fdebug.write('osascript -e "tell application \\"Terminal\\" to do script \\"cd $concorewd/' +containername+";"+ MATLABEXE+' -batch run\\\\\\(\\\\\\'+"'"+sourcecode+"\\\\\\'"+'\\\\\\)\\""\n' )


if concoretype=="posix":
fstop.write('#!/bin/bash' + "\n")
i=0 # 3/30/21
for node in nodes_dict:
containername,sourcecode = nodes_dict[node].split(':')
Expand All @@ -784,6 +792,8 @@
i=i+1
fstop.close()

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

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