Project-LemonLime / Project_LemonLime

为了 OI 比赛而生的基于 Lemon + LemonPlus 的轻量评测系统 | 三大桌面系统支持
GNU General Public License v3.0
560 stars 59 forks source link

[Feature] Write the results to CDF file immediately after each judging. #104

Open threo9 opened 3 years ago

threo9 commented 3 years ago

It's useful when I forget to close the program but I want to share the contest directory with someone, Or I don't want to close the program at now. In previous versions,the cdr file may be recorded no results. We can write the results to CDF file immediately after each judging, then it will be easier to share the contest directory,I think.

Dust1404 commented 3 years ago

If we write the results to the file after each judging, it might cause large amount of disk I/O, which is not good. To solve it, as early as in LemonPlus, it is supported to save file manually. It's in the menu of file(maybe, I remember). I can't remember if ctrl + s works.

threo9 commented 3 years ago

If we write the results to the file after each judging, it might cause large amount of disk I/O, which is not good. To solve it, as early as in LemonPlus, it is supported to save file manually. It's in the menu of file(maybe, I remember). I can't remember if ctrl + s works.

Emmm,it seems that LemonLime can also save manually. But I don't think writing the results to the file after each judging will cause large amount of disk I/O for a common contest. like a test in a team,Most cdf files are very small,so I don't think the amount of disk I/O will be large enough to have an impact to normal using.

undefined-moe commented 3 years ago

Think about this situation:

Lemon is running a large contest and the system or lemon crashed due to some reason (oom, malicious code, etc)

The result should be auto-saved (after each run, or after a delay)

undefined-moe commented 3 years ago

I think auto-saving for each 5min and create a backup for the old one(manually saved version) is a good way to handle this.

Dust1404 commented 3 years ago

I think auto-saving for each 5min and create a backup for the old one(manually saved version) is a good way to handle this.

I agree with u, an autosave at regular time intervals is a good choice.

But I think the work to change the file format is more important now.

As cena, if we divide each player's result file, problemset file, contest file and maybe more, we can save each instead of saving the whole contest. Than the immediate saving function can be reached easily.

undefined-moe commented 3 years ago

Too many files also leaks performance. I still think a simple json/xml/yaml file is better.

threo9 commented 3 years ago

@undefined-moe Let me start with something that happened in the past: Maybe I'm a pupil that time. We haved a contest and we have judged for dozens of minutes,but someone usedsystem("shutdown ") then we have to re-judge all the codes again. I think @Dust1404 's suggestion is feasible,but will it increase the difficulty of code to implement the operation of summing up grades?

undefined-moe commented 3 years ago

This is a problem related to sandbox module, not contest management module.

threo9 commented 3 years ago

Oh,we used lemon that time.

threo9 commented 3 years ago

This is a problem related to sandbox module, not contest management module.

But lost results show it's defects of saving mechanism

threo9 commented 3 years ago

ndbox module, not contest management module.

@undefined-moe btw,can problems like this be solved now?

undefined-moe commented 3 years ago

btw,can problems like this be solved now?

maybe by using something like sandboxie on windows, cgroup on linux ?

and I have an idea: create a .progress file when judging, write pid to the first line, and after each contestant's code finished running, append the result to the file. And when lemonlime starts, check if the file exists, then check if the pid is running. if pid is running, just display an error said the contest is locked by another lemonlime process, and if not, display a prompt: "Found a uncompleted progress, do you want to load it and continue?" with "Yes", "Yes, but skip this contestant", "No" options to user.

threo9 commented 3 years ago

btw,can problems like this be solved now?

maybe by using something like sandboxie on windows, cgroup on linux ?

and I have an idea: create a .progress file when judging, write pid to the first line, and after each contestant's code finished running, append the result to the file. And when lemonlime starts, check if the file exists, then check if the pid is running. if pid is running, just display an error said the contest is locked by another lemonlime process, and if not, display a prompt: "Found a uncompleted progress, do you want to load it and continue?" with "Yes", "Yes, but skip this contestant", "No" options to user.

Sounds great !

undefined-moe commented 3 years ago

Is this in progress? :thinking:

threo9 commented 3 years ago

Is this in progress? :thinking:

I also want to ask this question, It's very useful, I think @undefined-moe

threo9 commented 3 years ago

日常催更/xyx

alphagocc commented 3 years ago

Now results are written every 30s