Skip to content
Snippets Groups Projects
Commit acc45dbe authored by tuhe's avatar tuhe
Browse files

Updates

parent dadd26b9
No related branches found
No related tags found
No related merge requests found
Showing
with 130 additions and 773 deletions
from unitgrade2.unitgrade2 import UTestCase, Report, hide from src.unitgrade2.unitgrade2 import UTestCase, Report
from unitgrade2.unitgrade_helpers2 import evaluate_report_student from src.unitgrade2 import evaluate_report_student
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
...@@ -21,4 +21,6 @@ class Report3(Report): ...@@ -21,4 +21,6 @@ class Report3(Report):
pack_imports = [cs103] pack_imports = [cs103]
if __name__ == "__main__": if __name__ == "__main__":
# from unitgrade_private2.hidden_gather_upload import gather_upload_to_campusnet
# gather_upload_to_campusnet(Report3())
evaluate_report_student(Report3()) evaluate_report_student(Report3())
\ No newline at end of file
from unitgrade2.unitgrade2 import UTestCase, Report, hide from unitgrade2.unitgrade2 import UTestCase, Report, hide
from unitgrade2.unitgrade_helpers2 import evaluate_report_student from unitgrade2 import evaluate_report_student
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
...@@ -30,4 +30,6 @@ class Report3(Report): ...@@ -30,4 +30,6 @@ class Report3(Report):
pack_imports = [cs103] pack_imports = [cs103]
if __name__ == "__main__": if __name__ == "__main__":
# from unitgrade_private2.hidden_gather_upload import gather_upload_to_campusnet
# gather_upload_to_campusnet(Report3())
evaluate_report_student(Report3()) evaluate_report_student(Report3())
No preview for this file type
No preview for this file type
from unitgrade_private2.docker_helpers import docker_run_token_file
import os
import glob
import pickle
import time
""" Run all examples on docker. """
if __name__ == "__main__":
# Step 0: Compile our two docker images.
from unitgrade_private2.docker_helpers import compile_docker_image
docker_files = [f"{os.getcwd()}/../../docker_images/unitgrade-docker/Dockerfile"]
docker_tags = []
for f in docker_files:
tag = compile_docker_image(f)
docker_tags.append( (f, tag) )
EX_BASE = f"{os.getcwd()}/../" # Base of examples.
runs = [
("example_flat", "programs", "programs/report1flat_grade.py", "programs", "programs/report1flat_grade.py",),
("example_simplest", "", "cs101/report1_grade.py", "", "cs101/report1_grade.py", ),
("example_framework", "", "cs102/report2_grade.py", "", "cs102/report2_grade.py", ),
("example_docker", "", "cs103/report3_complete_grade.py", "", "cs103/report3_grade.py",),
]
rs = []
def p2mod(file, base):
return ".".join(os.path.normpath(os.path.relpath(file, base)).split(os.sep))[:-3]
start = time.time()
for ex, ibase, ig, sbase, sg in runs:
ibase = f"{EX_BASE}/{ex}/instructor/{ibase}"
ig = f"{EX_BASE}/{ex}/instructor/{ig}"
sbase = f"{EX_BASE}/{ex}/students/{sbase}"
sg = f"{EX_BASE}/{ex}/students/{sg}"
# Uncomment to run example deployment scripts:
# os.system(f"cd {ibase} && python -m {p2mod(os.path.dirname(ig) + '/deploy.py', ibase)}")
os.system(f"cd {sbase} && python -m { p2mod(sg, sbase) }")
stoken = glob.glob(f"{os.path.dirname(sg)}/*.token")[0]
Dockerfile, tag = docker_tags[0] # Get first docker file.
token = docker_run_token_file(Dockerfile_location=Dockerfile,
host_tmp_dir=os.path.dirname(Dockerfile) + "/tmp",
student_token_file=stoken,
instructor_grade_script=ig)
with open(token, 'rb') as f:
iresults = pickle.load(f)
with open(stoken, 'rb') as f:
sresults = pickle.load(f)
rs.append( (ex, sresults, iresults) )
for ex, sresults, iresults in rs:
print( f"[{ex}]", "Student's score was:", sresults['total'], "score using my eval script", iresults['total'])
print("Total elapsed time", time.time()-start, "seconds")
\ No newline at end of file
File added
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
""" """
Example student code. This file is automatically generated from the files in the instructor-directory Example student code. This file is automatically generated from the files in the instructor-directory
""" """
from unitgrade2.unitgrade2 import UTestCase, Report, hide from src.unitgrade2.unitgrade2 import UTestCase, Report
from unitgrade2.unitgrade_helpers2 import evaluate_report_student from src.unitgrade2 import evaluate_report_student
class Week1(UTestCase): class Week1(UTestCase):
""" The first question for week 1. """ """ The first question for week 1. """
...@@ -24,4 +24,6 @@ class Report3(Report): ...@@ -24,4 +24,6 @@ class Report3(Report):
pack_imports = [cs103] pack_imports = [cs103]
if __name__ == "__main__": if __name__ == "__main__":
# from unitgrade_private2.hidden_gather_upload import gather_upload_to_campusnet
# gather_upload_to_campusnet(Report3())
evaluate_report_student(Report3()) evaluate_report_student(Report3())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment