Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project work feedback #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Use [venv](https://docs.python.org/3/library/venv.html) to manage a virtual envi
To run the automated grading, first activate the virtual env, then execute grading.py with an optional work directory as first argument.

1. `source env/bin/activate`
2. `python grading.py <exerciseId>`
2. `python grading.py <exerciseId/projectWorkId>`, e.g. `python grading.py ex1`

# Use with CI
To use the automated grading feedback in student repositories in MADE, use the GitHub Actions workflow in`ci/grading-feedback.yml`. It sets up a GitHub action with Python 11 and Jayvee and then executes `./run_grading.sh`.
Expand Down
18 changes: 13 additions & 5 deletions ci/run_grading.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
cd grading
pip install -r requirements.txt

python grading.py 1 "../main" 2>&1 | stdbuf -oL tee feedback-ex1.txt
python grading.py 2 "../main" 2>&1 | stdbuf -oL tee feedback-ex2.txt
python grading.py 3 "../main" 2>&1 | stdbuf -oL tee feedback-ex3.txt
python grading.py 4 "../main" 2>&1 | stdbuf -oL tee feedback-ex4.txt
python grading.py 5 "../main" 2>&1 | stdbuf -oL tee feedback-ex5.txt
python grading.py ex1 "../main" 2>&1 | stdbuf -oL tee feedback-ex1.txt
python grading.py ex2 "../main" 2>&1 | stdbuf -oL tee feedback-ex2.txt
python grading.py ex3 "../main" 2>&1 | stdbuf -oL tee feedback-ex3.txt
python grading.py ex4 "../main" 2>&1 | stdbuf -oL tee feedback-ex4.txt
python grading.py ex5 "../main" 2>&1 | stdbuf -oL tee feedback-ex5.txt

python grading.py pw2 "../main" 2>&1 | stdbuf -oL tee feedback-pw2.txt
python grading.py pw3 "../main" 2>&1 | stdbuf -oL tee feedback-pw3.txt
python grading.py pw4 "../main" 2>&1 | stdbuf -oL tee feedback-pw4.txt
python grading.py pw5 "../main" 2>&1 | stdbuf -oL tee feedback-pw5.txt
python grading.py pw6 "../main" 2>&1 | stdbuf -oL tee feedback-pw6.txt
python grading.py pw7 "../main" 2>&1 | stdbuf -oL tee feedback-pw7.txt
python grading.py pw8 "../main" 2>&1 | stdbuf -oL tee feedback-pw8.txt
75 changes: 63 additions & 12 deletions grading.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,62 +64,113 @@ def gradeExercise(
print("")
print(feedback)


def gradeProjectWork(
pwNumber, expectedFiles
):
print(f"[INFO] Preparing feedback for PROJECT WORK {pwNumber}:")
print(
"[INFO] If this project work does not need to be submitted yet, you can ignore all output after this."
)

for expectedFile in expectedFiles:
print(f"\tLooking for file {expectedFile}.")
if not os.path.isfile(expectedFile):
print(f"\t[ERROR] Could not find file: {expectedFile}")
break

print(f"\t[SUCCESS] Found file: {expectedFile}.")

print("\t[INFO] That's all we can currently offer as quick feedback for this project work. The rest is manual grading at the end of the semester.")


if len(sys.argv) < 1:
print("Missing argument.\nUsage: python grading.py <exerciseId> <dir (optional)>")
print("Missing argument.\nUsage: python grading.py <exerciseId/projectWorkId> <dir (optional)>")
exit(1)

try:
exerciseId = int(sys.argv[1])
except ValueError:
print("The argument provided is not an integer.")
exit(1)
exerciseId = sys.argv[1]

if len(sys.argv) > 2:
os.chdir(sys.argv[2])

match (exerciseId):
case 1:
case "ex1":
gradeExercise(
1,
buildExercise1Rubric,
["exercises/exercise1.jv"],
"airports.sqlite",
"airports",
)
case 2:
case "ex2":
gradeExercise(
2,
buildExercise2Rubric,
["exercises/exercise2.jv"],
"trees.sqlite",
"trees",
)
case 3:
case "ex3":
gradeExercise(
3,
buildExercise3Rubric,
["exercises/exercise3.jv"],
"goodsTransportedByTrain.sqlite",
"goods",
)
case 4:
case "ex4":
gradeExercise(
4,
buildExercise4Rubric,
["exercises/exercise4.jv"],
"temperatures.sqlite",
"temperatures",
)
case 5:
case "ex5":
gradeExercise(
5,
buildExercise5Rubric,
["exercises/exercise5.jv"],
"gtfs.sqlite",
"stops",
)
case "pw2":
gradeProjectWork(
2,
["project/project-plan.md"],
)
case "pw3":
gradeProjectWork(
3,
["project/pipeline.sh"],
)
case "pw4":
gradeProjectWork(
4,
["project/data-report.pdf"],
)
case "pw5":
gradeProjectWork(
5,
["project/tests.sh"],
)
case "pw6":
gradeProjectWork(
6,
[".github/workflows/data-pipeline.yml"],
)
case "pw7":
gradeProjectWork(
7,
["project/analysis-report.pdf"],
)
case "pw8":
gradeProjectWork(
8,
["project/slides.pdf"],
)
case _:
print(f"No grading found for exercise with id {exerciseId}")
print(f"No grading found for submission with id {exerciseId}")



Expand Down