Closed timflutre closed 6 years ago
Hi ! I've started to think about this issue, it's not an easy one. Specify a max disk usage and prevent players from logged in is quite easy.
But with only these two features the game can't continue when the maximum size is reached.
To avoid that we should implement a feature to delete some data files (haplotype files). This can be done by uploading a .txt file specifying breeders' name and individuals' names they want to delete:
breeder \t id
breeder1 \t F1_XX_01
breeder1 \t F1_XX_02
breeder1 \t HD_XX_23
...
Two specific cases can appear: Players create this file by hand so very few individuals are deleted and the over memory usage issue will reappear soon after.
Players are aware of the over disk usage issue. So, to delete enough individuals, they use some R code to automatically generate this file. But by this way, deleting some important individuals will be very easy. It is quite risky to do that.
Please let me know your thinking about that.
ps: How about players who are already logged in ? I can find a way to log them out if the maximum disk usage is reached, but I am quite sure this will cause some bugs depending on what the players was doing (with the actual state of the app).
This issue is for cases of emergency on the current server, so for the moment, I would go for the easy solution:
specify a max disk usage and prevent players from logging in;
stop the game when the max disk usage is reached, and show a message explaining why.
Next, you can open another issue to improve on this, in which you write that one should allow players to choose which individuals to delete. This new issue isn't blocking.
Players can't log in anymore if the max disk usage is reached. (see commit: c181a9c60b379439a0030ae5df63b68d5e461c5e)
A calculation of the size of the data folder is done when the player click on the "log in" button. This slow down a bit the connection process (by around 2 seconds on my computer).
For now, users will not be log out automatically.
To add this feature, the size calculation of the data
folder must be done.
We should find a good moment to proceed this calculation (which is a bit slow).
It can be done before any genotyping, phenotyping or plant material request. If the disk is "full" the requested calculation will not be proceed, and a javascript alert will show up.
Rather than using a file data/truth/maxDiskUsage.RData
, I prefer to modify the table constants
by adding max.disk.usage
in units "Gb". I'll change the code in breeding-game_setup.Rmd
, using 10
as a default value. I let you change your SQLite table by hand (on your computer) and change the code.
Ok, thanks. I just changed "Mo" by "Gb" in ui_admin_loggedIn.R
. In this file, the default value is hard coded as "10", but I think it would be better to use the value from the database, no?
Moreover, I can't check if it works as I still can't connect to the app on my computer, even with 'test' (which has an empty password). It says "Sorry, the game is currently not available. Please contact your game master to figure out what to do.", but there is no message in the R console..
I think I found the error; I'm fixing it right now.