Skip to content

Commit

Permalink
Attempt to not overload the shell servers
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosk committed Feb 12, 2024
1 parent fd6163e commit 557de1e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/terminal/grading/grade.sh.nw
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ user:path.
We first upload a script to the server, then run it passing the list of
students through stdin.
The function takes the list of students as the list of arguments.

We want to rotate between the shell server to not trigger any load protections.
The faculty-shell server seems to go unavailable (network unreachable) after a
few invocations.
We favour the staff server, by two thirds.
We also introduce a small delay between runs.
<<function to get home directory>>=
get_home_directory() {
local shellserver="faculty-shell.sys.kth.se"
local shellserver="$(shuf -n1 -e faculty staff staff)-shell.sys.kth.se"
local script='
read students;
for s in $students; do
Expand All @@ -69,10 +75,16 @@ get_home_directory() {
local scriptname=$(echo $script | ssh ${shellserver} \
'read script; fn=$(mktemp); echo $script > $fn; echo $fn' 2> /dev/null)

sleep 2

echo $* | ssh ${shellserver} /bin/bash ${scriptname} \
2> /dev/null

sleep 2

ssh ${shellserver} rm -Rf ${scriptname} 2> /dev/null

sleep 30
}
@

Expand Down

0 comments on commit 557de1e

Please sign in to comment.