How to use lein to do Clojush runs on single nodes of fly

Here are some instructions to get a run going on a single node of fly by using leiningen (lein). This page should be enough to get you there if you know what you're doing, but could use some fleshing-out at some point. This file explains how to do this with leiningen launches and while maintaining project directory structure... see also hampedia.org/wiki/How_to_use_single_nodes_of_fly_for_Clojush_runs for a method using direct java calls (and not maintaining project directory structure).

First, install leiningen in your fly account if you have not already done so:


 * 1) cd ~/bin
 * 2) wget --no-check-certificate https://raw.github.com/technomancy/leiningen/stable/bin/lein
 * 3) chmod +x lein
 * 4) lein

and then if everything goes well lein will be set up.

For the rest, two methods are presented, using Github or not:

Using Github:


 * 1) Create a Git branch for your code on your local machine. You can use master if you want to use an example as-is; otherwise, let's suppose your branch is named cool-problem.
 * 2) (optional) Make sure your code is working on your local machine. Run it by using "lein run clojush.examples.cool-problem" from within your Clojush directory (that's assuming that your problem file is in src/examples/cool-problem.clj). If you don't get errors by the first generation, you should be good and can kill the run.
 * 3) Push your code to GitHub. Use your own fork or origin. This will entail something like "git push origin cool-problem".
 * 4) ssh to fly.
 * 5) ssh to a compute node.
 * 6) Start a screen session with something like "screen -S cool"
 * 7) (FIRST NOTE: read this whole step, including notes, before you get started) If you alread have a git-cloned version of Clojush on fly, cd to that. Otherwise, "git clone git@github.com:lspector/Clojush.git" will get clone Clojush from GitHub. Then, "cd clojush". (NOTE: If you haven't set up your fly account's ssh keys with GitHub, you'll have to do that before this step, but it's totally worth it. This will entail following the directions here, though DO NOT generate new keys. Instead. just do steps 1, 4, and 5, using the keys you should already have on fly. If you delete your current fly ssh keys, you will not be able to ssh to compute nodes.) (OTHER NOTE: If you don't want to mess with ssh keys as in NOTE, you could instead clone Clojush using the read-only link: git://github.com/lspector/Clojush.git . If you do this, you won't be able to push changes and new commits back to GitHub, but you won't have to worry about ssh keys).
 * 8) Now you should be in your Clojush directory. Get the branch you want to run by "git fetch origin" and then "git branch cool-problem origin/cool-problem" and then "git checkout cool-problem".
 * 9) You should now have the code you want to run. You can look around to make sure this is the case.
 * 10) Run your code. You'll want to do something like "lein run clojush.examples.cool-problem | tee out.txt".
 * 11) Make sure the run has started smoothly.
 * 12) Detach your screen "C-a d".
 * 13) Logout of fly. Later, ssh back into the node you are running on. Resume screen with "screen -r cool". If things are finished, you can look at the new out.txt file and do whatever else you want. When you're done with screen, make sure you close it with "C-d".

Not using Github:


 * 1) (optional) Make sure your code is working on your local machine. Run it by using "lein run clojush.examples.cool-problem" from within your Clojush directory (that's assuming that your problem file is in src/examples/cool-problem.clj). If you don't get errors by the first generation, you should be good and can kill the run.
 * 2) Zip up your Clojush directory and scp it to your fly account.
 * 3) ssh to fly.
 * 4) ssh to a compute node.
 * 5) Start a screen session with something like "screen -S cool"
 * 6) Unzip your Clojush directory and cd into it.
 * 7) Run your code. You'll want to do something like "lein run clojush.examples.cool-problem | tee out.txt".
 * 8) Make sure the run has started smoothly.
 * 9) Detach your screen "C-a d".
 * 10) Logout of fly. Later, ssh back into the node you are running on. Resume screen with "screen -r cool". If things are finished, you can look at the new out.txt file and do whatever else you want. When you're done with screen, make sure you close it with "C-d".