Bug 49227 - Implement the possibility to collect interim exam results in defined time intervals
Implement the possibility to collect interim exam results in defined time int...
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Exam mode
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v3
Assigned To: Ole Schwiegert
Daniel Tröder
:
Depends on:
Blocks: 49333
  Show dependency treegraph
 
Reported: 2019-04-04 09:37 CEST by Ole Schwiegert
Modified: 2019-05-08 22:26 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ole Schwiegert univentionstaff 2019-04-04 09:37:47 CEST
User Story from Trello Board:

Als Lehrkraft möchte ich, dass Zwischenstände der Ergebnisse einer Klassenarbeit zwischengespeichert werden, um Datenverlust zu verhindern.
- Das Zeitintervall (Standard 5 min) sollte per UCR-Variable konfigurierbar sein.
- In einen Unterordner Zwischenergebnisse
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2019-04-08 11:42:41 CEST
Note: with hardlinks I would be careful: with hardlinks there is only one file on the disk, even if there are several file names pointing to it. If the teacher now modifies "one of the files", the content of the "other" hard linked files has also been changed.
This may be surprising for end users and may lead to data loss.
Comment 2 Ole Schwiegert univentionstaff 2019-04-11 14:17:24 CEST
Proposal implemented in oschwieg/4.4/49227
(umc-distribution and umc-exam are modified)

Please reopen the bug for merge, yaml and build.

The Project class in the distribution module now has a readOnly flag, which if set, creates the collected students data as read only (it is still deletable)

/usr/share/ucs-school-exam/exam-backup was added. It iterates over all project definitions for exams and collects them into the teachers home folder with the suffix -Zwischenergebnisse (name was decided by Michel).

Since only active exams have a project definition in /var/lib/ucs-school-umc-schoolexam/ this behavior should suffice.

Though this might be subject to further changes if we alter the structure of the exam mode in future user stories!

A cron job was added which executes that script every 5 minutes by default. The UCRV
ucsschool/exam/cron/backup
ucsschool/exam/cron/backup/activated

were added to configure the cron timestamp and if the job should be activated or not.
Comment 3 Daniel Tröder univentionstaff 2019-04-12 16:16:53 CEST
Merged, built and tested.

[4.4] f7d6da042 Bug #49227: Add script to backup exam data into a Backup folder in the teachers home directory
[4.4] ede3c58b2 Bug #49227: Run exam backup script by cron every 5 minutes by default. Configure via UCRV
[4.4] 81a256383 Bug #49227: changelogs and advisories
[4.4] 81f5eaf0f Bug #49227: Merge branch 'oschwieg/4.4/49227' into 4.4
[4.4] 2ed748953 Bug #49227: advisory update

ucs-school-umc-exam (9.0.0-5)
ucs-school-umc-distribution (17.0.0-1)

OK: UCRV descriptions
OK: code change
OK: in manual test with two simultaneous exams, all files are collected and versioned
OK: no hard linking used
OK: UCRVs modify cron job as expected
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2019-04-12 16:40:21 CEST
The UCR variables and the default behaviour (backup every 5min) should be documented, e.g. in
http://docs.software-univention.de/ucsschool-handbuch-4.4.html#school:exam:configuration
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2019-04-12 16:51:23 CEST
(In reply to Sönke Schwardt-Krummrich from comment #4)
> The UCR variables and the default behaviour (backup every 5min) should be
> documented, e.g. in
> http://docs.software-univention.de/ucsschool-handbuch-4.4.html#school:exam:
> configuration

The manual should describe clearly what it means if the exam mode backups every 5min:

45/5 → 9 Backups per school lesson

15 Users * (45min/5min) * 5 MB  →   675 MB
25 Users * (45min/5min) * 10 MB → 2.250 MB → 2.2 GB
25 Users * (90min/5min) * 15 MB → 6.750 MB → 6.7 GB

What if an exam is started for several hours? Abiturprüfungen?

200 Users * (180min/5min) * 5 MB → 36.000 MB → 36GB

The following questions are not for the manual but for us:
Is there an automatic limit? 
Or does the exam backup try to copy files until there's no free disk space left?
Comment 6 Michel Smidt 2019-04-15 10:10:54 CEST
> 
> The following questions are not for the manual but for us:
> Is there an automatic limit? 
> Or does the exam backup try to copy files until there's no free disk space
> left?

From the user point of view:
- The last result must always be saved.
- If no space left the oldest intermediate results should be removed. 


For School Admins / Domain Admins:
- A message should appear when login at the UMC that space is running out.
Comment 7 Daniel Tröder univentionstaff 2019-04-15 11:59:13 CEST
(In reply to Michel Smidt from comment #6)
> From the user point of view:
> - The last result must always be saved.
> - If no space left the oldest intermediate results should be removed. 
This must already be true when creating intermediate results.

If multiple exams are written at the same time, it is possible that at the end one won't be able to store its results. That is already now the came, so this is not a regression.
IMHO this danger can only be handled by checking the free space _before_ starting an exam, and prevent the start if not at least X MB are free.

> For School Admins / Domain Admins:
> - A message should appear when login at the UMC that space is running out.
This is already checked by Nagios (if installed and observed).
A message in the UMC is a good idea. Please create an issues with the management team.
Comment 8 Ole Schwiegert univentionstaff 2019-04-16 09:15:53 CEST
The initial goal of this feature was to prevent data loss if students save the files in the wrong directory, delete their files by accident, etc. 

How about an additional configuration option, that allows setting a limit for the amount of backups that are kept for one single exam. When X backups are reached, the oldest version is removed before creating a new one.

This would allow the school admins to measure risk of data loss against availability of storage and decide for themselves how much space they want to dedicate to this new backup functionality. Of course it should still be possible to remove that limit (e.g setting the variable to a negative number).

Of course there can still be the situation that exactly the backup where the data was still available was deleted by this mechanism, but that problem can indeed only be solved by providing 'inifite' storage capacity.


Another option we have for reducing the impact on storage would be to compress these backups. They are not intended for day to day usage -- thats what the Ergebnisse folder is for. The backups should only ever be needed in case of missing data. So IMHO these folders not being immediately accesible without decompression is no problem.

So if we would implement:
- Configurable backup number limit per exam
- Freeing an old backup for a new one in any case if the space runs out
- Compressing the backups

We would counter many potential problems.

The two other problems mentioned (Notification of low storage in UMC and the already existing problem with running out of space as explained by Daniel) exceed the scope of this ticket and User Story in my opinion and it should be sufficient if we handle the backup mechanism only here.
Comment 9 Ole Schwiegert univentionstaff 2019-04-23 10:56:03 CEST
Package: ucs-school-umc-exam
Version: 9.0.0-6A~4.4.0.201904231051
Branch: ucs_4.4-0
Scope: ucs-school-4.4

As discussed to stay in the scope of the defined user story this feature will be kept as is and the deletion mechanism and handling of missing space will be handed as an improvement to the feature in another user story.

To avoid problems with customers the feature will be deactivated by default for now. This will be changed back when the mentioned improvements are implemented.
Comment 10 Ole Schwiegert univentionstaff 2019-04-23 11:13:15 CEST
Documentation was added and bug was cloned for further improvements in the next sprint
Comment 11 Ole Schwiegert univentionstaff 2019-04-23 11:30:36 CEST
Package: ucs-school-umc-exam
Version: 9.0.0-7A~4.4.0.201904231130
Branch: ucs_4.4-0
Scope: ucs-school-4.4

Fixed some typos
Comment 12 Daniel Tröder univentionstaff 2019-04-23 12:54:48 CEST
OK: documentation
Fixed some more typos: [4.4 fb3c253fc] Bug #49227: fix typos
Comment 13 Sönke Schwardt-Krummrich univentionstaff 2019-05-08 22:26:26 CEST
UCS@school 4.4 v2 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.4v2-de.html

If this error occurs again, please clone this bug.