To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 30 seconds to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
import Pluto
4.6 s
👀 Reading hidden code
import UUIDs: UUID
153 μs
👀 Reading hidden code
import Distributed
124 μs
👀 Reading hidden code
using PlutoUI
167 ms
👀 Reading hidden code
using DataFrames
1.4 s
👀 Reading hidden code
import CSV
225 ms

Part 1: autograding

👀 Reading hidden code
184 μs

Step 1: Select submission files

👀 Reading hidden code
162 μs
Error message

IOError: readdir("/home/fons/disorganised-mess/autograding/submissions/"): no such file or directory (ENOENT)

Stack trace

Here is what happened, the most recent locations are first:

  1. uv_error
  2. readdir(dir::String; join::Bool, sort::Bool)
  3. submission_files = readdir("/home/fons/disorganised-mess/autograding/submissions/"; join=true)
submission_files = readdir("/home/fons/disorganised-mess/autograding/submissions/"; join=true)
👀 Reading hidden code
---
Error message

Another cell defining submission_files contains errors.

if !all(isabspath, submission_files)
md"""
!!! warning
Submission paths need to be _absolute_
"""
end
👀 Reading hidden code
---

Step 2: autograde actions

👀 Reading hidden code
159 μs
actions = [
GetValue("name", :(student.name)),
GetValue("email", :(student.email)),
GetValue("number", :(student.number)),
Assignment("big number", 5, quote
big_number > 100
end),
Assignment("ispositive", 10, quote
ispositive(20) && !ispositive(0)
end),
]
👀 Reading hidden code
28.7 ms
naming_function (generic function with 1 method)
function naming_function(notebook::Pluto.Notebook, action_results::Vector)
action_results[3]
end
👀 Reading hidden code
412 μs

Step 3: autograde all notebooks

👀 Reading hidden code
159 μs
Error message

Another cell defining submission_files contains errors.

uhmmmmmm??!
md"**Click to start autograding:**

$(@bind run_notebooks CheckBox()) run $(length(submission_files)) notebooks

---"
👀 Reading hidden code
---
pluto_session = Pluto.ServerSession()
👀 Reading hidden code
152 ms
submission_files_to_run = run_notebooks ? Pluto.tamepath.(submission_files) : String[]
👀 Reading hidden code
214 μs
👀 Reading hidden code
67.4 μs
👀 Reading hidden code
116 ms
👀 Reading hidden code
57.9 μs
(This table has no columns)
(This table has no rows)
👀 Reading hidden code
400 ms
👀 Reading hidden code
418 ms

Part 2: manual review

👀 Reading hidden code
161 μs

Step 1: start notebook server

👀 Reading hidden code
159 μs

Click to start notebook server:

run notebook server


👀 Reading hidden code
931 μs
if run_server
@async Pluto.run(2468; session=pluto_session)
md"> Server is running at [https://localhost:2468](https://localhost:2468)"
end
👀 Reading hidden code
5.0 ms

Step 2: select notebook

👀 Reading hidden code
159 μs
Error message

BoundsError: attempt to access 0-element Vector{Pair} at index [1]

Stack trace

Here is what happened, the most recent locations are first:

  1. getindex
  2. first(a::Vector{Pair})
  3. get(select::PlutoUI.BuiltinsNotebook.Select)
  4. macro expansion
  5. Show more...
@bind inspected_notebook_index_str Select([string(i) => nb.path for (i,nb) in enumerate(notebooks)])
👀 Reading hidden code
---
Error message

Another cell defining inspected_notebook_index_str contains errors.

Oh no! 🙀
autograde_results_df[inspected_notebook_index, :]
👀 Reading hidden code
---
👀 Reading hidden code
255 μs

a

asdff

@bind manual_results let
boxes = map(manual) do name
"""<p><input type='checkbox' id='$(name)' $(rand(Bool) ? "checked" : "")> $(name)</p>"""
end
"""
<div id="hello">
$(join(boxes))
</div>
<script>
const div = this.querySelector("#hello")
const boxes = div.querySelectorAll("input")
boxes.forEach(el => {
el.oninput = () => {
div.value = Object.fromEntries(Array.from(boxes).map((b) => [b.id, b.checked]))
}
})

</script>
""" |> HTML
end
👀 Reading hidden code
76.5 ms
manual = ["a", "asdff"]
👀 Reading hidden code
14.0 μs
h (generic function with 1 method)
h(x) = repr(MIME"text/html"(), x)
👀 Reading hidden code
437 μs
"<input type=\"checkbox\" checked>"
h(CheckBox(;default=true))
👀 Reading hidden code
23.1 ms
missing
manual_results
👀 Reading hidden code
9.7 μs
DownloadButton(sprint(CSV.write, autograde_results_df), "manual_results.csv")
👀 Reading hidden code
229 μs
Error message

Another cell defining inspected_notebook_index_str contains errors.

inspected_notebook_index = parse(Int, inspected_notebook_index_str)
👀 Reading hidden code
---
Error message

Another cell defining inspected_notebook_index_str contains errors.

beep boop CRASH 🤖
inspected_notebook = notebooks[inspected_notebook_index]
👀 Reading hidden code
---

Appendix

👀 Reading hidden code
156 μs

Grading actions

👀 Reading hidden code
193 μs
abstract type GradingAction end
👀 Reading hidden code
475 μs
struct Assignment <: GradingAction
name
points_value::Number
test::Expr
end
👀 Reading hidden code
1.3 ms
struct GetValue <: GradingAction
name
getter::Expr
end
👀 Reading hidden code
1.2 ms
do_action (generic function with 2 methods)
begin
function do_action(notebook::Pluto.Notebook, action::Assignment)
tester = quote
try
$(action.test)
catch
false
end
end
if eval_in_notebook(notebook, tester)
action.points_value
else
zero(action.points_value)
end
end
function do_action(notebook::Pluto.Notebook, action::GetValue)
eval_in_notebook(notebook, action.getter)
end
end
👀 Reading hidden code
1.1 ms
displayname (generic function with 1 method)
begin
# default
displayname(action::GradingAction) = action.name
end
👀 Reading hidden code
386 μs

Misc

👀 Reading hidden code
159 μs
eval_in_notebook (generic function with 1 method)
function eval_in_notebook(notebook::Pluto.Notebook, expr)
withenv("PLUTO_WORKSPACE_USE_DISTRIBUTED" => "no thanks") do
ws = Pluto.WorkspaceManager.get_workspace(notebook)
fetcher = :(Core.eval($(ws.module_name), $(expr |> QuoteNode)))
Distributed.remotecall_eval(Main, ws.pid, fetcher)
end
end
👀 Reading hidden code
1.2 ms

Not used

(because it can't export to CSV)

👀 Reading hidden code
688 μs
struct PointsOutOf
value
max_value
end
👀 Reading hidden code
866 μs
+ (generic function with 219 methods)
👀 Reading hidden code
588 μs
👀 Reading hidden code
3.0 ms