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

certificates && git push

parent 8bf49a76
Branches
No related tags found
No related merge requests found
Showing
with 235 additions and 43 deletions
......@@ -228,7 +228,7 @@ When this is run, the titles are shown as follows:
| | | |_ __ _| |_| | \/_ __ __ _ __| | ___
| | | | '_ \| | __| | __| '__/ _` |/ _` |/ _ \
| |_| | | | | | |_| |_\ \ | | (_| | (_| | __/
\___/|_| |_|_|\__|\____/_| \__,_|\__,_|\___| v0.1.17, started: 21/09/2021 11:56:22
\___/|_| |_|_|\__|\____/_| \__,_|\__,_|\___| v0.1.17, started: 21/09/2021 11:57:05
CS 102 Report 2
Question 1: Week1
......@@ -242,7 +242,7 @@ Question 2: The same problem as before with nicer titles
* q2.2) Checking if reverse_list([1, 2, 3]) = [3, 2, 1]............................................................PASS
* q2) Total...................................................................................................... 6/6
Total points at 11:56:22 (0 minutes, 0 seconds)....................................................................16/16
Total points at 11:57:05 (0 minutes, 0 seconds)....................................................................16/16
Including files in upload...
* cs102
......@@ -540,12 +540,12 @@ and TAs can choose to annotate the students code directly in Autolab -- we are h
# Citing
```bibtex
@online{unitgrade_devel,
title={Unitgrade-devel (0.1.27): \texttt{pip install unitgrade-devel}},
title={Unitgrade-devel (0.1.35): \texttt{pip install unitgrade-devel}},
url={https://lab.compute.dtu.dk/tuhe/unitgrade_private},
urldate = {2021-09-21},
urldate = {2022-05-19},
month={9},
publisher={Technical University of Denmark (DTU)},
author={Tue Herlau},
year={2021},
year={2022},
}
```
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIGdzCCBF+gAwIBAgIKYQ00SQABAAAACDANBgkqhkiG9w0BAQsFADBOMQswCQYD
VQQGEwJESzEmMCQGA1UEChMdRGFubWFya3MgVGVrbmlza2UgVW5pdmVyc2l0ZXQx
FzAVBgNVBAMTDkRUVSBST09UIENBIDAxMB4XDTE1MTIwMjExMTUzMFoXDTI3MTIw
MjExMjUzMFowcDESMBAGCgmSJomT8ixkAR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tW3wijRQABbjO7EUCtRYq
-----END CERTIFICATE-----
\ No newline at end of file
# https://wiki.fysik.dtu.dk/it/Exchange_IMAP_Email#exchange-ldap-address-book
"""
https://serverfault.com/questions/153526/how-can-i-find-the-ldap-server-in-the-dns-on-windows
"""
from ldap3 import Server, Connection, ALL, NTLM, SIMPLE, SASL
from ldap3 import ObjectDef
from pathlib import Path
if __name__ == "__main__":
home = str(Path.home())
server = Server('ait-padfdc20.win.dtu.dk', use_ssl=True)
with open(home + "/.passw", 'r') as f:
passw = f.read()
conn = Connection(server, user="win\\tuhe", password=passw, authentication=SIMPLE)
bound = conn.bind()
print("Did bind?", bound)
who = conn.extend.standard.who_am_i()
print("Who?", who)
# person = ObjectDef('inetOrgPerson')
# import ldap3
# ldap3.Reader(conn, person, 'member=CN=tuhe,OU=xxx,OU=xxxxxx,DC=mydomain,DC=com', 'DC=win,DC=dtu,DC=dk').search()
# conn.extend.standard.paged_search
# con = ldap.initialize('ldap://192.168.16.12:38')
# user_dn = r"Administrator@foo.com"
# password = "bar"
criteria = "(&(objectClass=user)(sAMAccountName=tuhe))"
# attributes = ['displayName', 'company']
base = 'DC=win,DC=dtu,DC=dk'
sr = conn.extend.standard.paged_search(base, search_filter=criteria)
sr = list(sr)
for r in sr:
print(r)
print(sr)
print( list(conn.search(base, search_filter=criteria)) )
sr = list(sr)
# try:
# con.simple_bind_s(user_dn, password)
# res = con.search_s("CN=Users,DC=foo,DC=com", ldap.SCOPE_SUBTREE, '(objectClass=User)')
......@@ -29,7 +29,7 @@ RUN chmod +s /usr/bin/autodriver
# Do the python stuff.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Clean up
WORKDIR /home
......
......@@ -9,7 +9,7 @@ WORKDIR /home
# Remember to include requirements.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Not required.
# RUN pip install git+https://git@gitlab.compute.dtu.dk/tuhe/unitgrade.git
......@@ -17,5 +17,3 @@ RUN pip3 install -r requirements.txt
COPY . .
ADD . /home
# CMD [ "python3", "app.py"]
......@@ -39,19 +39,9 @@ if __name__ == "__main__":
f.write(out)
# os.system("cd ../examples/example_framework/instructor && python -m cs102.report2_grade")
data['bibtex'] = bib
data = {**data, **dump_data("../examples")}
# import glob
# fls = [f for f in glob.glob("../examples/**/*.*", recursive=True) if f.split(".")[-1] in ["py", "txt", "shell"] ]
# import os
# # fls = [(f, ) for f in fls]
# for file in fls:
# with open(file, 'r') as f:
# k = os.path.relpath(file, "../examples").replace(os.sep, "_").replace(".", "_")
# data[k] = f.read()
data['resources'] = "https://gitlab.compute.dtu.dk/tuhe/unitgrade_private/-/raw/master"
with open("README.jinja.md", 'r') as f:
......
......@@ -33,7 +33,7 @@ class Week1QuestionGroup(QuestionGroup):
class GraphTraversalQuestion(QPrintItem):
def compute_answer_print(self):
from irlc.ex01 import graph_traversal
from irlc.ex02 import graph_traversal
graph_traversal.main()
class Report0(Report):
......
......@@ -3,7 +3,7 @@
| | | |_ __ _| |_| | \/_ __ __ _ __| | ___
| | | | '_ \| | __| | __| '__/ _` |/ _` |/ _ \
| |_| | | | | | |_| |_\ \ | | (_| | (_| | __/
\___/|_| |_|_|\__|\____/_| \__,_|\__,_|\___| v0.1.17, started: 21/09/2021 11:57:05
\___/|_| |_|_|\__|\____/_| \__,_|\__,_|\___| v0.1.17, started: 19/05/2022 15:14:09
CS 102 Report 2
Question 1: Week1
......@@ -17,7 +17,7 @@ Question 2: The same problem as before with nicer titles
* q2.2) Checking if reverse_list([1, 2, 3]) = [3, 2, 1]............................................................PASS
* q2) Total...................................................................................................... 6/6
Total points at 11:57:05 (0 minutes, 0 seconds)....................................................................16/16
Total points at 15:14:09 (0 minutes, 0 seconds)....................................................................16/16
Including files in upload...
* cs102
......
@online{unitgrade_devel,
title={Unitgrade-devel (0.1.27): \texttt{pip install unitgrade-devel}},
title={Unitgrade-devel (0.1.35): \texttt{pip install unitgrade-devel}},
url={https://lab.compute.dtu.dk/tuhe/unitgrade_private},
urldate = {2021-09-21},
urldate = {2022-05-19},
month={9},
publisher={Technical University of Denmark (DTU)},
author={Tue Herlau},
year={2021},
year={2022},
}
\ No newline at end of file
......@@ -29,7 +29,7 @@ RUN chmod +s /usr/bin/autodriver
# Do the python stuff.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Clean up
WORKDIR /home
......
......@@ -9,7 +9,7 @@ WORKDIR /home
# Remember to include requirements.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Not required.
# RUN pip install git+https://git@gitlab.compute.dtu.dk/tuhe/unitgrade.git
......
......@@ -29,7 +29,7 @@ RUN chmod +s /usr/bin/autodriver
# Do the python stuff.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Clean up
WORKDIR /home
......
......@@ -9,7 +9,7 @@ WORKDIR /home
# Remember to include requirements.
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements_pip.txt
# Not required.
# RUN pip install git+https://git@gitlab.compute.dtu.dk/tuhe/unitgrade.git
......
def derivative(f, x, epsilon):
'''
Given a function f, a point x, and a (small) number epsilon, this function should approximately compute the derivative
$$
df/dx \approx (f(x + \epsilon) - f(x))/\epsilon
$$
:param f:
:param x:
:param epsilon:
:return:
'''
return (f(x+epsilon)-f(x))/epsilon
def riemann_integrate_xs(a, b, N):
pass
def riemann_integrate(f, a, b, N):
pass
Metadata-Version: 2.1
Name: unitgrade-devel
Version: 0.1.28
Version: 0.1.35
Summary: A set of tools to develop unitgrade tests and reports and later evaluate them
Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade_private
Author: Tue Herlau
......
......@@ -101,8 +101,14 @@ def student_token_file_runner(host_tmp_dir, student_token_file, instructor_grade
return pycom, token_location
def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file, tag=None, instructor_grade_script=None, fix_user=None):
def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file, tag=None, instructor_grade_script=None,
fix_user=None,
# grade_script_relative_destination_dir=None, # The relative location relative to the top-dir containing the package. Example: irlc/project1
xvfb=True):
"""
xvfb: Control whether to use X-windows. Works on linux. This seems like a good idea when using e.g. gym.
This thingy works:
To build the image, run:
......@@ -113,6 +119,10 @@ def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file,
docker run -v c:/Users/tuhe/Documents/2021/python-docker/tmp:/app python-docker > output.log
"""
Dockerfile_location = Dockerfile_location.replace("\\", "/")
host_tmp_dir = host_tmp_dir.replace("\\", "/")
student_token_file = student_token_file.replace("\\", "/")
# A bunch of tests. This is going to be great!
Dockerfile_location = os.path.abspath(Dockerfile_location)
assert os.path.exists(Dockerfile_location)
......@@ -138,8 +148,19 @@ def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file,
# Done extracting the zip file! Now time to move the (good) report test class into the location.
gscript = instructor_grade_script
student_grade_script = host_tmp_dir + "/" + sources['report_relative_location']
instructor_grade_script = os.path.dirname(student_grade_script) + "/"+os.path.basename(gscript)
# if grade_script_relative_destination_dir is None:
# student_grade_script = host_tmp_dir + "/" + sources['report_relative_location']
# else:
# student_grade_script = host_tmp_dir + "/" + grade_script_relative_destination_dir
# Get relative location from first line of the grade script.
with open(instructor_grade_script, 'r') as f:
student_grade_script_dir = os.path.dirname( host_tmp_dir + "/" + f.read().splitlines()[0][1:].strip() )
print("student_grade_script", student_grade_script_dir)
student_grade_script_dir = student_grade_script_dir.replace("\\", "/")
instructor_grade_script = student_grade_script_dir + "/"+os.path.basename(gscript)
shutil.copy(gscript, instructor_grade_script)
"""
......@@ -151,14 +172,20 @@ def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file,
dockname = tag
tmp_grade_file = sources['name'] + "/" + sources['report_relative_location']
tmp_grade_file = tmp_grade_file.replace("\\", "/")
pycom = ".".join( sources['report_module_specification'][:-1] + [os.path.basename(gscript)[:-3],] )
# pycom = ".".join( sources['report_module_specification'][:-1] + [os.path.basename(gscript)[:-3],] )
pycom = ".".join(os.path.relpath(instructor_grade_script, host_tmp_dir)[:-3].split("/"))
pycom = "python3 -m " + pycom
if fix_user:
user_cmd = ' --user "$(id -u):$(id -g)" '
else:
user_cmd = ''
if xvfb:
user_cmd = " -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix " + user_cmd
tmp_path = os.path.abspath(host_tmp_dir).replace("\\", "/")
dcom = f"docker run {user_cmd} -v {tmp_path}:/home {dockname} {pycom}"
cdcom = f"cd {os.path.dirname(Dockerfile_location)}"
......@@ -167,11 +194,14 @@ def docker_run_token_file(Dockerfile_location, host_tmp_dir, student_token_file,
print(fcom)
init = time.time() - start
# thtools.execute_command(fcom.split())
subprocess.check_output(fcom, shell=True).decode("utf-8")
out = subprocess.check_output(fcom, shell=True).decode("utf-8")
host_tmp_dir +"/" + os.path.dirname(tmp_grade_file) + "/"
tokens = glob.glob( os.path.dirname(instructor_grade_script) + "/*.token" )
for t in tokens:
print("Source image produced token", t)
elapsed = time.time() - start
print("Elapsed time is", elapsed, f"({init=} seconds)")
if len(tokens) != 1:
print("Wrong number of tokens produced:", len(tokens))
print(out)
return tokens[0]
......@@ -92,6 +92,12 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
'head': pyhead})
output = fn[:-3] + "_grade.py"
print("> Writing student script to", output, "(this script may be shared)")
# Add the relative location string:
# Add relative location to first line of file. Important for evaluation/sanity-checking.
report_relative_dir = report._import_base_relative()[1]
s = "# " + report_relative_dir + "\n" + s
with open(output, 'w', encoding="utf-8") as f:
f.write(s)
......@@ -114,6 +120,7 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
wa = """ WARNING: Modifying, decompiling or otherwise tampering with this script, it's data or the resulting .token file will be investigated as a cheating attempt. """
sauce = ["'''" + wa + "'''"] + sauce[:-1]
sauce = "\n".join(sauce)
sauce = "# " + report_relative_dir + "\n" + sauce
with open(output, 'w') as f:
f.write(sauce)
......@@ -124,3 +131,4 @@ def setup_grade_file_report(ReportClass, execute=False, obfuscate=False, minify=
s = os.path.basename(fn)[:-3] + "_grade"
exec("import " + s)
a = 234
print("====== EXECUTION AND PACKING OF REPORT IS COMPLETE ======")
......@@ -23,7 +23,14 @@ def gather_imports(imp):
top_package = os.path.dirname(m.__file__)
module_import = True
else:
top_package = __import__(m.__name__.split('.')[0]).__path__._path[0]
im = __import__(m.__name__.split('.')[0])
if isinstance(im, list):
print("im is a list")
print(im)
# the __path__ attribute *may* be a string in some cases. I had to fix this.
print("path.:", __import__(m.__name__.split('.')[0]).__path__)
# top_package = __import__(m.__name__.split('.')[0]).__path__._path[0]
top_package = __import__(m.__name__.split('.')[0]).__path__[0]
module_import = False
found_hashes = {}
......@@ -89,13 +96,24 @@ def gather_report_source_include(report):
print(f" * {m.__name__}")
return sources
def gather_upload_to_campusnet(report, output_dir=None):
# def report_script_relative_location(report):
# """
# Given the grade script corresponding to the 'report', work out it's relative location either compared to the
# package it is in or directory.
# """
# if len(report.individual_imports) == 0:
# return "./"
# else:
#
# pass
def gather_upload_to_campusnet(report, output_dir=None, token_include_plaintext_source=False):
# n = report.nL
args = parser.parse_args()
results, table_data = evaluate_report(report, show_help_flag=False, show_expected=False, show_computed=False, silent=True,
show_progress_bar=not args.noprogress,
big_header=not args.autolab)
big_header=not args.autolab,
)
print("")
sources = {}
if not args.autolab:
......@@ -123,6 +141,7 @@ def gather_upload_to_campusnet(report, output_dir=None):
if hash in known_hashes and f_rel not in cov_files and use_coverage:
print("Skipping", f_rel)
else:
if token_include_plaintext_source:
s_include.append("#"*3 +" Content of " + f_rel +" " + "#"*3)
s_include.append("")
s_include.append(s['pycode'][f_rel])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment