Skip to content

Commit

Permalink
[feat/#72] Add: scoring pipeline(response value and time also)
Browse files Browse the repository at this point in the history
  • Loading branch information
NayeonKeum committed Aug 26, 2023
1 parent 2edc238 commit f645c16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions resources/images/professor-ubuntu/server/getValueAndTime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

start=`date +%s.%N`

/usr/bin/python3 $1 > values.txt

finish=`date +%s.%N`
diff=$( echo "$finish - $start" | bc -l )

echo $diff > time.txt
10 changes: 10 additions & 0 deletions resources/images/professor-ubuntu/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,22 @@ async def create_assignment(assignment_info: Dto.AssignmentModel = None):
async def get_assignment(id: str, assignment_id: str):
dir_path_professor = Urls.dir_path_professor
dir_path = "%s/%s/%s" % (dir_path_professor, assignment_id, id)
curr_path = os.path.dirname(os.path.realpath(__file__))
file_list = os.listdir(dir_path)
return_dict = {}
for file in file_list:
f = open(dir_path+"/"+file, "r")
content = f.read()
return_dict["content"] = content
f.close()
os.system('/bin/bash %s/getValueAndTime.sh' % curr_path)
f = open("%s/values.txt" % curr_path, "r")
values = f.read()
return_dict["values"] = values
f.close()
f = open("%s/time.txt" % curr_path, "r")
time = f.read()
return_dict["time"] = time
f.close()

return json.dumps(return_dict)

0 comments on commit f645c16

Please sign in to comment.