bed1ad4f0846951c64619761e25b79291569f3b1
[arvados.git] / doc / install / install-crunch-dispatch.textile
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the Crunch dispatcher
5 navorder: 3
6 ---
7
8 h1. Crunch setup
9
10 h4. Perl SDK dependencies
11
12 * @apt-get install libjson-perl libwww-perl libio-socket-ssl-perl libipc-system-simple-perl@
13
14 h4. Python SDK dependencies
15
16 * @apt-get install python-pip@
17 * @pip install --upgrade google-api-python-client@
18
19 h4. Repositories
20
21 Crunch scripts must be in git repositories in @/var/cache/git/*/.git@ (or whatever is configured in @services/api/config/environments/production.rb@).
22
23 h4. Importing commits
24
25 @services/api/script/import_commits.rb production@ must run periodically. Example @/var/service/arvados_import_commits/run@ script for daemontools or runit:
26
27 <pre>
28 #!/bin/sh
29 set -e
30 while sleep 60
31 do
32   cd /path/to/arvados/services/api
33   setuidgid www-data env RAILS_ENV=production /usr/local/rvm/bin/rvm 2.0.0 do bundle exec ./script/import_commits.rb 2>&1
34 done
35 </pre>
36
37 Once you have imported some commits, you should be able to create a new job:
38
39 <pre>
40 read -rd "\000" newjob <<EOF; arv job create --job "$newjob"
41 {"script_parameters":{"input":"f815ec01d5d2f11cb12874ab2ed50daa"},
42  "script_version":"master",
43  "script":"hash"}
44 EOF
45 </pre>
46
47 Without getting this error:
48
49 <pre>
50 ArgumentError: Specified script_version does not resolve to a commit
51 </pre>
52
53 h4. Running jobs
54
55 * @services/api/script/crunch-dispatch.rb@ must be running.
56 * @crunch-dispatch.rb@ needs @services/crunch/crunch-job@ in its @PATH@.
57 * @crunch-job@ needs @sdk/perl/lib@ and @warehouse-apps/libwarehouse-perl/lib@ in its @PERLLIB@
58 * @crunch-job@ needs @ARVADOS_API_HOST@ (and, if necessary in a development environment, @ARVADOS_API_HOST_INSECURE@)
59
60 Example @/var/service/arvados_crunch_dispatch/run@ script:
61
62 <pre>
63 #!/bin/sh
64 set -e
65 export PATH="$PATH":/path/to/arvados/services/crunch
66 export PERLLIB=/path/to/arvados/sdk/perl/lib:/path/to/warehouse-apps/libwarehouse-perl/lib
67 export ARVADOS_API_HOST=xyzzy.arvadosapi.com
68
69 ## Only if your SSL cert is unverifiable:
70 # export ARVADOS_API_HOST_INSECURE=yes
71
72 cd /path/to/arvados/services/api
73 RAILS_ENV=production /usr/local/rvm/bin/rvm 2.0.0 do bundle exec ./script/crunch-dispatch.rb 2>&1
74 </pre>