##My computer
I have been using the same MacBook Air for just over three years now. It has been a great computer and I think that it has a lot of life left in it, but occasionally it has some issues, most of which revolve around memory. When I am using R to work with large data sets and have more non-essential files stored on my computer than usual, I encounter kernal panics, runaway processes, and extreme sluggishness in every aspect of the computer include mouse movement and changing window focus. The whole computer becomes essentially unusable, the code usually never finishes running and I have to start over. I would happily trade almost any other problem in my life for more of these computer issues (which is essentially “I can’t listen to spotify and code”), but it has been especially galling during the last year.
##I’ve been doing a lot of data mining
Which means I am working with large datasets a lot lately. This means that my computer issues have become a daily routine for me in the last few weeks. It has gotten so irritating that I finally decided to learn how to use our department’s computing resources. Specifically, I took advantage of an opportunity to learn how to batch submit my code to the linux machines the department keeps for us.
##Submit R code to the terminal servers The basic things that I needed were commands log in to the terminal (which prompts me for my password):
where
is the port number 1
-p 323
is the terminal
that I am trying to log in to, and 1
impact3.stat.iastate.edu
is identifies my username.
I also needed to be able to batch submit my R code (which we will call 1
-l imouzon
):1
test.r
which can run without locking up my system at all and without being greedy about resources by using the following:
keeps running the code even if I logout and 1
nohup
submits the code at low enough
priority that it won’t interfere with other users work.1
nice
##Using Vim to submit code and gather the results Since I do everything in Vim, it made sense to automate the code so that I could submit the code out of Vim using a single command. This led me to write a function that copies the code I am working on from my personal computer to the terminal, runs the code using the terminal servers, and returns the results of the submission to my computer. As a side note, this whole process is only possible because I set up my computer so that I wouldn’t have to enter my password every time I log on to the server.
A function to copy the current file to the impact server:
A function to run R code in the terminal:
A function that copies the current R file, submits to the terminal, and moves the output to the local folder the R code is stored in:
and an easy to remember key binding that does all of this automatically: