I have to process a dataset in my server, and using different parameters.
This a dummy example of what I'm doing
if (!require("pacman")) install.packages("pacman")
p_load(dplyr,DBI)
mtcars_experiments = dbConnect(RSQLite::SQLite(), "mtcars_experiments.sqlite")
for(a in -1:1) {
for(b in -1:1) {
for(c in -1:1) {
mtcars_experiment = mtcars %>%
mutate(my_col = mpg^a + cyl^b + disp^c)
dbWriteTable(mtcars_experiments, paste("mtcars_experiment",a,b,c, sep = "_"), mtcars_experiment)
}
}
}
Two possibilities:
1) Add Sys.sleep(1)
after every iteration. This consumes no resources, and does nothing 1 second after every iteration.
2) Lower the priority of the process. In ubuntu, you can do this by renice 20 PROCESS_ID
(20 is the lowest priority).