README.md 4.63 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
1. Clone repository
Markus Klinik's avatar
README    
Markus Klinik committed
72

Markus Klinik's avatar
README    
Markus Klinik committed
73
74
75
76
```
$ git clone --recurse-submodules https://gitlab.science.ru.nl/objectorientatie/personal-prof.git
$ cd personal-prof
```
Markus Klinik's avatar
README    
Markus Klinik committed
77

Markus Klinik's avatar
README    
Markus Klinik committed
78
3. Optional: Run tests
Markus Klinik's avatar
README    
Markus Klinik committed
79

Markus Klinik's avatar
README    
Markus Klinik committed
80
81
82
```
$ ./test.sh
```
Markus Klinik's avatar
README    
Markus Klinik committed
83

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

Markus Klinik's avatar
README    
Markus Klinik committed
86
87
88
89
```
$ mkdir -p ~/.config/grading-tools
$ mkdir -p ~/.config/personal-prof
```
Markus Klinik's avatar
README    
Markus Klinik committed
90

Markus Klinik's avatar
README    
Markus Klinik committed
91
5. Copy config files to config direcotries
Markus Klinik's avatar
README    
Markus Klinik committed
92

Markus Klinik's avatar
README    
Markus Klinik committed
93
94
95
96
97
```
$ 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
98

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

Markus Klinik's avatar
README    
Markus Klinik committed
101
102
103
```
$ vim ~/.config/personal-prof/app.json.config
```
Markus Klinik's avatar
README    
Markus Klinik committed
104

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

Markus Klinik's avatar
README    
Markus Klinik committed
107
108
109
```
$ vim ~/.config/grading-tools/app.json.config
```
Markus Klinik's avatar
README    
Markus Klinik committed
110

Markus Klinik's avatar
README    
Markus Klinik committed
111
7. Install d2lvalence python module
Markus Klinik's avatar
README    
Markus Klinik committed
112

Markus Klinik's avatar
README    
Markus Klinik committed
113
114
115
```
$ pip3 install D2LValence
```
Markus Klinik's avatar
README    
Markus Klinik committed
116

Markus Klinik's avatar
README    
Markus Klinik committed
117
8. Log in with no-bs
Markus Klinik's avatar
README    
Markus Klinik committed
118

Markus Klinik's avatar
README    
Markus Klinik committed
119
120
121
122
```
$ cd brightspace-grading-tool/grading-tool-python/
$ ./no-bs login-manual
```
Markus Klinik's avatar
README    
Markus Klinik committed
123

Markus Klinik's avatar
README    
Markus Klinik committed
124
9. See if it works
Markus Klinik's avatar
README    
Markus Klinik committed
125

Markus Klinik's avatar
README    
Markus Klinik committed
126
127
128
129
```
$ ./no-bs list-courses
$ ./no-bs list-folders <course-id>
```
Markus Klinik's avatar
README    
Markus Klinik committed
130

Markus Klinik's avatar
README    
Markus Klinik committed
131
10. Start the daemon
Markus Klinik's avatar
README    
Markus Klinik committed
132

Markus Klinik's avatar
README    
Markus Klinik committed
133
134
135
136
137
```
$ 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
138
139
140



Markus Klinik's avatar
README    
Markus Klinik committed
141
142
143
# Contributing

If you want to work on Personal Prof, use eclipse-rcp.
Markus Klinik's avatar
README    
Markus Klinik committed
144

Markus Klinik's avatar
README    
Markus Klinik committed
145
## Developing the rules
Markus Klinik's avatar
README    
Markus Klinik committed
146

Markus Klinik's avatar
README    
Markus Klinik committed
147
148
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
157
158
159
160
161
## 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

        $ ./test.sh

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

        $ ./test.sh Assignment02RulesSpec.rsc Assignment03RulesSpec.rsc
Markus Klinik's avatar
README    
Markus Klinik committed
162
163
164



Markus Klinik's avatar
README    
Markus Klinik committed
165

Markus Klinik's avatar
README    
Markus Klinik committed
166
# References
Markus Klinik's avatar
README    
Markus Klinik committed
167
168
169
170

- 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