Skip to content

Commit

Permalink
library modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahuljagwani committed Jul 31, 2023
1 parent d031e3d commit d744a46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
20 changes: 0 additions & 20 deletions fri/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,85 +117,69 @@ def build(dir):
output_bytes = subprocess.check_output(["makedocker", makestudy_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
try:
output_bytes = subprocess.check_output(["makestudy", makestudy_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["makedocker", makestudy_dir, out_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
try:
output_bytes = subprocess.check_output(["makestudy", makestudy_dir, out_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
if(out_dir == None or out_dir == ""):
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["./makedocker", makestudy_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
try:
output_bytes = subprocess.check_output(["./makestudy", makestudy_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["./makedocker", makestudy_dir, out_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
else:
try:
output_bytes = subprocess.check_output(["./makestudy", makestudy_dir, out_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
print(output_str)
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
print(output_str)
if(proc == 0):
resp = jsonify({'message': 'Directory successfully created'})
resp.status_code = 201
Expand All @@ -206,11 +190,9 @@ def build(dir):
try:
output_bytes = subprocess.check_output("build", cwd=dir_path, shell=True)
output_str = output_str + output_bytes.decode("utf-8")
print(output_str)
resp = jsonify({'message': 'Directory successfully created', 'output': output_str})
except subprocess.CalledProcessError as e:
output_str = f"Build failed with return code {e.returncode}"
print(output_str)
resp = jsonify({'message': 'Build Failed', 'output': output_str})
resp.status_code = 500
if(maxtime != None and maxtime != ''):
Expand All @@ -221,11 +203,9 @@ def build(dir):
try:
output_bytes = subprocess.check_output("./build", cwd=dir_path)
output_str = output_str + output_bytes.decode("utf-8")
print(output_str)
resp = jsonify({'message': 'Directory successfully created', 'output': output_str})
except subprocess.CalledProcessError as e:
output_str = f"Build failed with return code {e.returncode}"
print(output_str)
resp = jsonify({'message': 'Build Failed', 'output': output_str})
resp.status_code = 500
if(maxtime != None and maxtime != ''):
Expand Down
3 changes: 2 additions & 1 deletion library
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ if [ $# = 0 ]
if [ -e $tooldir/$filename ]
then
ln -s $tooldir/$filename $filename
echo "library link created"
else
echo "$filename does not exist"
echo "$filename does not exist in $tooldir"
fi
else
echo "$tooldir does not exist"
Expand Down

0 comments on commit d744a46

Please sign in to comment.