README.md 4.72 KB
Newer Older
1
# Personal Prof
Markus Klinik's avatar
Markus Klinik committed
2

Markus Klinik's avatar
README    
Markus Klinik committed
3
4
5
Rascal implementation of a rule checker for student Java assignments. See also
the accompanying paper
https://gitlab.science.ru.nl/objectorientatie/personal-prof-paper
Markus Klinik's avatar
Markus Klinik committed
6

Markus Klinik's avatar
README    
Markus Klinik committed
7
8
9
10
11
Personal Prof consists of two parts: The rule checker itself and the
Brightspace daemon. The rule checker is called **Personal Prof**, the
Brightspace integration is called **pp-bs-daemon**. The rule checker is written
in Rascal, which runs on the Java Virtual Machine. The Brightspace daemon is
written in Python 3.
Markus Klinik's avatar
README    
Markus Klinik committed
12
13


Markus Klinik's avatar
README    
Markus Klinik committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

## Running Personal Prof

To run Personal Prof, you need a rascal jar and the Personal Prof source code.
Both can be found in this repository. The rascal jar can be found in `src/lib`
and the source code in `src`. To run Personal Prof, you have to call java as
follows.

```
$ cd src
$ java -Xmx1G -Xss32m -jar lib/rascal-0.15.2-SNAPSHOT.jar Main.rsc <ruleset-name> <absolute-path-to-project-under-test>
```

- Rascal sometimes needs lots of memory to parse big projects, the official
  Rascal documentation recommends running java with `-Xmx1G -Xss32m`
- Due to the way Rascal module loading works, you have to run it from the
  directory where `Main.rsc` is
- Rascal needs absolute paths to open files. The path to the project under test
  must be absolute
- To see which rulesets are available, look at the big switch statement in
  `Main.rsc`

There is a script `run.sh` which simplifies running Personal Prof. This script
can handle relative paths to the project under test.
Markus Klinik's avatar
Markus Klinik committed
38
39
40

1. Run the script

Markus Klinik's avatar
README    
Markus Klinik committed
41
42
43
```
$ ./run.sh <ruleset-name> <path-to-student-project>
```
Markus Klinik's avatar
README    
Markus Klinik committed
44

Markus Klinik's avatar
README    
Markus Klinik committed
45
  For example
Markus Klinik's avatar
Markus Klinik committed
46

Markus Klinik's avatar
README    
Markus Klinik committed
47
48
49
50
51
```
$ ./run.sh hangman ~/tmp/oo-grading-2020/assignment02-hangman/grading/TA_Name/128863\ -\ 34172\ -\ AsgnA\ 142\ -\ Student\ Name\ -\ 2020-02-16T09_23_57.733Z/submission/
Gallows should use StringBuilder
at |java+class:///hangman/Gallows|
```
Markus Klinik's avatar
README    
Markus Klinik committed
52
53


Markus Klinik's avatar
README    
Markus Klinik committed
54
# Running The Brightspace Daemon
Markus Klinik's avatar
README    
Markus Klinik committed
55

Markus Klinik's avatar
README    
Markus Klinik committed
56
57
58
59
The Brightspace deamon is a Python 3 program that periodically polls
Brightspace for new student submissions. When a new student submission is
detected, the daemon downloads it, runs Personal Prof, and uploads the
resulting feedback to Brightspace.
Markus Klinik's avatar
README    
Markus Klinik committed
60

Markus Klinik's avatar
README    
Markus Klinik committed
61
62
63
For all this to work, the daemon needs two dependencies: the Personal Prof and
no-bs. no-bs is a Python library and command line program to interact with
Brightspace. Both dependencies are included in this repository.
Markus Klinik's avatar
README    
Markus Klinik committed
64

Markus Klinik's avatar
README    
Markus Klinik committed
65
66
67
68
69
no-bs is a component that can run independently of the daemon. You have to set
up no-bs first, before you can run the daemon. no-bs has its own configuration
file, and you have to use no-bs to log in to Brightspace. This needs to be done
only once. Logging in with no-bs stores a long-term authentication cookie on
your computer.
Markus Klinik's avatar
README    
Markus Klinik committed
70

Markus Klinik's avatar
README    
Markus Klinik committed
71
72
73
74
The basic steps to set up no-bs are described in this README. For more
information about no-bs see
https://gitlab.science.ru.nl/objectorientatie/brightspace-grading-tool

Markus Klinik's avatar
README    
Markus Klinik committed
75
1. Clone repository
Markus Klinik's avatar
README    
Markus Klinik committed
76

Markus Klinik's avatar
README    
Markus Klinik committed
77
78
79
80
```
$ git clone --recurse-submodules https://gitlab.science.ru.nl/objectorientatie/personal-prof.git
$ cd personal-prof
```
Markus Klinik's avatar
README    
Markus Klinik committed
81

Markus Klinik's avatar
README    
Markus Klinik committed
82
3. Optional: Run tests
Markus Klinik's avatar
README    
Markus Klinik committed
83

Markus Klinik's avatar
README    
Markus Klinik committed
84
85
86
```
$ ./test.sh
```
Markus Klinik's avatar
README    
Markus Klinik committed
87

Markus Klinik's avatar
README    
Markus Klinik committed
88
4. Create config directories for no-bs and pp-bs-daemon
Markus Klinik's avatar
README    
Markus Klinik committed
89

Markus Klinik's avatar
README    
Markus Klinik committed
90
91
92
93
```
$ mkdir -p ~/.config/grading-tools
$ mkdir -p ~/.config/personal-prof
```
Markus Klinik's avatar
README    
Markus Klinik committed
94

Markus Klinik's avatar
README    
Markus Klinik committed
95
5. Copy config files to config direcotries
Markus Klinik's avatar
README    
Markus Klinik committed
96

Markus Klinik's avatar
README    
Markus Klinik committed
97
98
99
100
101
```
$ cd brightspace-integration
$ cp app.json.config ~/.config/personal-prof
$ cp brightspace-grading-tool/grading-tool-python/app.json.config.default ~/.config/grading-tools/app.json.config
```
Markus Klinik's avatar
README    
Markus Klinik committed
102

Markus Klinik's avatar
README    
Markus Klinik committed
103
6. Edit config files. For no-bs you have to set `lms_url` and `courses`.
Markus Klinik's avatar
README    
Markus Klinik committed
104

Markus Klinik's avatar
README    
Markus Klinik committed
105
106
107
```
$ vim ~/.config/personal-prof/app.json.config
```
Markus Klinik's avatar
README    
Markus Klinik committed
108

Markus Klinik's avatar
README    
Markus Klinik committed
109
For pp-bs-daemon you have to set `rascalJar` and `personalProfInstallPath`
Markus Klinik's avatar
README    
Markus Klinik committed
110

Markus Klinik's avatar
README    
Markus Klinik committed
111
112
113
```
$ vim ~/.config/grading-tools/app.json.config
```
Markus Klinik's avatar
README    
Markus Klinik committed
114

Markus Klinik's avatar
README    
Markus Klinik committed
115
7. Install d2lvalence python module
Markus Klinik's avatar
README    
Markus Klinik committed
116

Markus Klinik's avatar
README    
Markus Klinik committed
117
118
119
```
$ pip3 install D2LValence
```
Markus Klinik's avatar
README    
Markus Klinik committed
120

Markus Klinik's avatar
README    
Markus Klinik committed
121
8. Log in with no-bs
Markus Klinik's avatar
README    
Markus Klinik committed
122

Markus Klinik's avatar
README    
Markus Klinik committed
123
124
125
126
```
$ cd brightspace-grading-tool/grading-tool-python/
$ ./no-bs login-manual
```
Markus Klinik's avatar
README    
Markus Klinik committed
127

Markus Klinik's avatar
README    
Markus Klinik committed
128
9. See if it works
Markus Klinik's avatar
README    
Markus Klinik committed
129

Markus Klinik's avatar
README    
Markus Klinik committed
130
131
132
133
```
$ ./no-bs list-courses
$ ./no-bs list-folders <course-id>
```
Markus Klinik's avatar
README    
Markus Klinik committed
134

Markus Klinik's avatar
README    
Markus Klinik committed
135
10. Start the daemon
Markus Klinik's avatar
README    
Markus Klinik committed
136

Markus Klinik's avatar
README    
Markus Klinik committed
137
138
139
140
141
```
$ export PYTHONPATH=`readlink -f brightspace-grading-tool/grading-tool-python`
$ screen
$ ./personal-prof run <course-name> <folder-id> <target-directory> <ruleset-name>
```
Markus Klinik's avatar
README    
Markus Klinik committed
142
143
144



Markus Klinik's avatar
README    
Markus Klinik committed
145
146
147
148
# Contributing

To develop rascal code, use eclipse-rcp. Follow the instructions here:
https://www.rascal-mpl.org/start/
Markus Klinik's avatar
README    
Markus Klinik committed
149
150


Markus Klinik's avatar
README    
Markus Klinik committed
151
152
153
154
155
156
## Running the test cases

There are some test projects and test cases to check that the rules give
correct error messages. To run the tests, use the test script. The test script
looks for all files `*Spec.rsc` and executes them

Markus Klinik's avatar
README    
Markus Klinik committed
157
158
159
```
$ ./test.sh
```
Markus Klinik's avatar
README    
Markus Klinik committed
160
161
162

To test only specific files, specify them on the command line.

Markus Klinik's avatar
README    
Markus Klinik committed
163
164
165
```
$ ./test.sh Assignment02RulesSpec.rsc Assignment03RulesSpec.rsc
```
Markus Klinik's avatar
README    
Markus Klinik committed
166
167
168



Markus Klinik's avatar
README    
Markus Klinik committed
169

Markus Klinik's avatar
README    
Markus Klinik committed
170
# References
Markus Klinik's avatar
README    
Markus Klinik committed
171
172
173
174

- Rascal official website https://www.rascal-mpl.org/
- Rascal github https://github.com/usethesource/rascal
- Rascal documentation http://tutor.rascal-mpl.org/Rascal/Rascal.html