4 title: "Tutorial: Your first job"
8 h1. Tutorial: Your first job
10 Here you will use the "arv" command line tool to run a simple Crunch script on some sample data.
14 * Log in to a VM "using SSH":ssh-access.html
15 * Put an "API token":api-tokens.html in your @ARVADOS_API_TOKEN@ environment variable
16 * Put the API host name in your @ARVADOS_API_HOST@ environment variable
18 If everything is set up correctly, the command @arv -h user current@ will display your account information.
20 Arv depends on a few gems. It will tell you which ones to install, if they are not present yet. If you need to install the dependencies and are doing so as a non-root user, make sure you set GEM_HOME before you run gem install:
23 export GEM_HOME=~/.gem
28 We will run the "hash" program, which computes the MD5 hash of each file in a collection.
30 Pick a data collection. We'll use @f815ec01d5d2f11cb12874ab2ed50daa@ here.
33 the_collection=f815ec01d5d2f11cb12874ab2ed50daa
36 Pick a code version. We'll use @cdde7f246fec59bc99da86145fd4cf4efcf37a68@ here.
39 the_version=cdde7f246fec59bc99da86145fd4cf4efcf37a68
42 Make a JSON object describing the job.
45 read -rd "\000" the_job <<EOF
48 "script_version":"$the_version",
51 "input":"$the_collection"
57 (The @read -rd "\000"@ stuff just helps us get a multi-line string with lots of double quotation marks into a shell variable.)
62 arv -h job create --job "$the_job"
65 Go to Workbench, drop down the Compute menu, and click Jobs. The job you submitted should appear at the top of the list.
67 Hit "Refresh" until it finishes.
69 You can also watch the log messages while the job runs:
72 curl -s -H "Authorization: OAuth2 $ARVADOS_API_TOKEN" \
73 https://{{ site.arvados_api_host }}/arvados/v1/jobs/JOB_UUID_HERE/log_tail_follow