README.md 4.29 KB
Newer Older
Cyril Matthey-Doret's avatar
Cyril Matthey-Doret committed
1
# Advanced teaching automation :robot: :mortar_board:
2

3
Leverage Renku and Gitlab to automate class management.
4

5
## Target audience
6

7
This repository is intended for technically inclined teachers who use Renku and/or Gitlab in their class and wish to automate repetitive tasks related to student and project management.
8

9
## Purpose
10

11
We showcase the potential of Renku + Gitlab through a few scripts covering common use-cases.
Cyril Matthey-Doret's avatar
Cyril Matthey-Doret committed
12
These scripts can be used as-provided, but are also meant to be extended and adapted by teachers for their specific needs.
13

14
## Content
15

16
The following tasks are covered:
17

Cyril Matthey-Doret's avatar
Cyril Matthey-Doret committed
18
19
20
21
22
23
* [Inviting students to the class group](#inviting-students-to-the-class-group)
* [Creating student groups](#creating-student-groups)
* [Gathering all forks of a project](#gathering-all-forks-of-a-project)
* [Cloning all forks of a project](#cloning-all-forks-of-a-project)
* [Sending feedback](#sending-feedback)

24
### Inviting students to the class group
25

26
Creating a single group for the class allows to have a centralizd place to store all materials, students repositories and exercises. In some cases, one may also want to make this group private.
27

28
The manual process of inviting the whole class to the group can be automated using Gitlab's invitation API. Given a list of student email addresses (e.g. exported from moodle) and the URL to a gitlab group, we provide a script to automatically send an invitation email to each student.
29

30
script: [scripts/invite_students.py](scripts/invite_students.py)
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
usage: `python invite_moodle.py moodle_students_list.csv https://gitlab-instance.com/group-name`


### Creating student groups

When students work on graded assignments, they will usually have to work in private groups. The groups must be accessible to the teachers in order to grade the assignments.

One way to achieve this is to have the teacher create all private student groups (they will therefore be the group owner) and then invite students to their respective groups. We provide a script to automate the group creation and invitation process.

script: [scripts/create_student_groups.py](scripts/create_student_groups.py)

usage: `python create_student_groups.py] students_moodle.csv`

### Gathering all forks of a project

Homework assignment can be provided by the teachers in the form of a repository containing instructions and depencencies required. Students can then fork this project into their own private groups (e.g. created with the script above).

The teacher can then use the Gitlab API to keep track of all student's forks. We provide a script to gather metadata about all student-group forks of a given project, with the option to retrieve the last commit before a deadline. That script will output the metadata as a JSON structure containing the following fields for each fork:

Cyril Matthey-Doret's avatar
Cyril Matthey-Doret committed
51
52
53
54
55
56
57
58
59
* `id`: The gitlab project ID of the fork
* `url`: The https URL to reach the fork
* `group`: The student group name
* `members`: The members of the group. For each member the following fields are provided:
  + `username`: The gitlab username
  + `name`: The full name (First_name Last_name)
  + `email`: The email address of the student
* `commit`: The hash of the last commit before the deadline, used for grading the assignment.
* `autostart_url`: A URL to directly start a Renku session at the last commit before the deadline.
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

script: [scripts/collect_forks.py](scripts/collect_forks.py)

usage:

```sh
python collect_forks.py \
  --token token.asc \
  --deadline "YYYY-MM-DDThh-mm-ss" \
  https://gitlab-instance.com/namespace/upstream-project \
  > forks.json
```

### Cloning all forks of a project

In some cases, the student projects may have to be cloned locally by the teacher. We provide a shell script to automate this process. This script will read the JSON output from `collect_forks.py` and clone all the forks at the deadline commit into a target directory.

script: [scripts/clone_forks.sh](scripts/clone_forks.sh)

usage: `python clone_forks.sh forks.json clone_dir`

### Sending feedback

After grading student assignment, the teacher may want to send student groups their grades, as well as positive or critical comments on their solution. This can be automated as well, using the Gitlab issues API. We provide a script to read a csv file containing grades and comments for each student group and open issues in the corresponding repositories automatically.

> TODO