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

updates

parent 06d07c1c
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,8 @@ class Question2(UTestCase): #!s=c ...@@ -60,6 +60,8 @@ class Question2(UTestCase): #!s=c
class Report2(Report): class Report2(Report):
version = 1.0
url = "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/tree/master/examples/autolab_example_py_upload/instructor/cs102_autolab"
title = "CS 106a" title = "CS 106a"
questions = [(Week1, 10), (Week1Titles, 6)] questions = [(Week1, 10), (Week1Titles, 6)]
pack_imports = [homework1] pack_imports = [homework1]
......
...@@ -91,18 +91,6 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I ...@@ -91,18 +91,6 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I
In case the students should not upload the token, we do something else. In case the students should not upload the token, we do something else.
But what? But what?
""" """
# INSTRUCTOR_REPORT_CLASS.pack_imports
# report = INSTRUCTOR_REPORT_CLASS()
# INSTRUCTOR_REPORT_CLASS
# from unitgrade_private.deployment.deploy import setup
from unitgrade_private.hidden_create_files import setup_grade_file_report
# Don't give a shit about compression, but execute the report to get a valid token file.
# output = setup_grade_file_report(INSTRUCTOR_REPORT_CLASS, execute=False)
# deploy_assignment()
# deploy_directly = COURSES_BASE != None
if COURSES_BASE == None: if COURSES_BASE == None:
COURSES_BASE = os.getcwd() + "/../tmp" COURSES_BASE = os.getcwd() + "/../tmp"
if not os.path.exists(COURSES_BASE): if not os.path.exists(COURSES_BASE):
...@@ -123,18 +111,15 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I ...@@ -123,18 +111,15 @@ def new_deploy_assignment(base_name, INSTRUCTOR_REPORT_CLASS, INSTRUCTOR_BASE, I
# Now we have the instructor token file. Let's get the student token file. # Now we have the instructor token file. Let's get the student token file.
total_ = res['total'][1] total_ = res['total'][1]
problems = [] problems = []
problems.append(dict(name='Unitgrade score', description='', max_score=total_, optional='false')) problems.append(dict(name='Unitgrade score', description='Score obtained by automatic grading', max_score=total_, optional='false'))
print(problems) problems.append(dict(name='Written feedback', description='Written (TA) feedback', max_score=0, optional='true'))
# print(problems)
sc = [('Total', res['total'][0])] + [(q['title'], q['obtained']) for k, q in res['details'].items()] sc = [('Total', res['total'][0])] + [(q['title'], q['obtained']) for k, q in res['details'].items()]
ss = ", ".join([f'"{t}": {s}' for t, s in sc]) ss = ", ".join([f'"{t}": {s}' for t, s in sc])
scores = '{"scores": {' + ss + '}}' scores = '{"scores": {' + ss + '}}'
print(scores)
# Quickly make student .token file to upload:
# os.system(f"cd {os.path.dirname(STUDENT_HANDOUT_DIR)} && python -m programs.{os.path.basename(INSTRUCTOR_GRADE_FILE)[:-3]}")
# os.system(f"cd {STUDENT_HANDOUT_DIR} && python {os.path.basename(INSTRUCTOR_GRADE_FILE)}")
# handin_filename = os.path.basename(STUDENT_TOKEN_FILE)
run_relative(STUDENT_GRADE_FILE, STUDENT_BASE) run_relative(STUDENT_GRADE_FILE, STUDENT_BASE)
# if student_should_upload_token:
STUDENT_TOKEN_FILE = glob.glob(os.path.dirname(STUDENT_GRADE_FILE) + "/*.token")[0] STUDENT_TOKEN_FILE = glob.glob(os.path.dirname(STUDENT_GRADE_FILE) + "/*.token")[0]
handin_filename = os.path.basename(STUDENT_TOKEN_FILE) handin_filename = os.path.basename(STUDENT_TOKEN_FILE)
for _ in range(3): for _ in range(3):
......
...@@ -51,8 +51,7 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify= ...@@ -51,8 +51,7 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
payload['config']['blake2b_file_hashes'] = known_hashes payload['config']['blake2b_file_hashes'] = known_hashes
time.sleep(0.1) time.sleep(0.1)
print("Packing student files...") print("Packing student files...")
# pack report into a binary blob thingy the students can run on their own.
# report = ReportClass()
fn = inspect.getfile(ReportClass) fn = inspect.getfile(ReportClass)
with open(fn, 'r') as f: with open(fn, 'r') as f:
report1_source = f.read() report1_source = f.read()
...@@ -78,13 +77,13 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify= ...@@ -78,13 +77,13 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
from unitgrade import version from unitgrade import version
from unitgrade import utils from unitgrade import utils
from unitgrade import runners from unitgrade import runners
print(unitgrade.__file__) # print(unitgrade.__file__)
report1_source = lload([unitgrade.__file__, utils.__file__, runners.__file__, unitgrade.framework.__file__, report1_source = lload([unitgrade.__file__, utils.__file__, runners.__file__, unitgrade.framework.__file__,
unitgrade.evaluate.__file__, hidden_gather_upload.__file__, unitgrade.evaluate.__file__, hidden_gather_upload.__file__,
version.__file__], excl) + "\n" + report1_source version.__file__], excl) + "\n" + report1_source
print(sys.getsizeof(picklestring)) # print(sys.getsizeof(picklestring))
print(len(picklestring)) # print(len(picklestring))
s = jinja2.Environment().from_string(data).render({'Report1': ReportClass.__name__, s = jinja2.Environment().from_string(data).render({'Report1': ReportClass.__name__,
'source': repr(report1_source), 'source': repr(report1_source),
'payload': picklestring.hex(), #repr(picklestring), 'payload': picklestring.hex(), #repr(picklestring),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment