Merge branch '2072-workbench-docker'
[arvados.git] / doc / install / install-crunch-dispatch.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the Crunch dispatcher
5
6 ...
7
8 h1. Crunch setup
9
10 The dispatcher normally runs on the same host/VM as the API server.
11
12 h4. Perl SDK dependencies
13
14 * @apt-get install libjson-perl libwww-perl libio-socket-ssl-perl libipc-system-simple-perl@
15
16 h4. Python SDK dependencies
17
18 On controller and all compute nodes:
19
20 * @apt-get install python-pip@
21 * @pip install --upgrade google-api-python-client@
22
23 h4. Likely crunch job dependencies
24
25 On compute nodes:
26
27 * @pip install --upgrade pyvcf@
28
29 h4. Redis
30
31 On controller:
32
33 * @apt-get install redis-server@
34
35 h4. Crunch user account
36
37 On compute nodes and controller:
38
39 * @adduser crunch@
40
41 The crunch user should have the same UID, GID, and home directory on all compute nodes and on the controller.
42
43 h4. Repositories
44
45 Crunch scripts must be in git repositories in @/var/cache/git/*/.git@ (or whatever is configured in @services/api/config/environments/production.rb@).
46
47 h4. Importing commits
48
49 @services/api/script/import_commits.rb production@ must run periodically. Example @/var/service/arvados_import_commits/run@ script for daemontools or runit:
50
51 <pre>
52 #!/bin/sh
53 set -e
54 while sleep 60
55 do
56   cd /path/to/arvados/services/api
57   setuidgid www-data env RAILS_ENV=production /usr/local/rvm/bin/rvm 2.0.0 do bundle exec ./script/import_commits.rb 2>&1
58 done
59 </pre>
60
61 Once you have imported some commits, you should be able to create a new job:
62
63 <pre>
64 read -rd $'\000' newjob <<EOF; arv job create --job "$newjob"
65 {"script_parameters":{"input":"f815ec01d5d2f11cb12874ab2ed50daa"},
66  "script_version":"master",
67  "script":"hash"}
68 EOF
69 </pre>
70
71 Without getting this error:
72
73 <pre>
74 ArgumentError: Specified script_version does not resolve to a commit
75 </pre>
76
77 h4. Running jobs
78
79 * @services/api/script/crunch-dispatch.rb@ must be running.
80 * @crunch-dispatch.rb@ needs @services/crunch/crunch-job@ in its @PATH@.
81 * @crunch-job@ needs @sdk/perl/lib@ and @warehouse-apps/libwarehouse-perl/lib@ in its @PERLLIB@
82 * @crunch-job@ needs @ARVADOS_API_HOST@ (and, if necessary in a development environment, @ARVADOS_API_HOST_INSECURE@)
83
84 Example @/var/service/arvados_crunch_dispatch/run@ script:
85
86 <pre>
87 #!/bin/sh
88 set -e
89 export PATH="$PATH":/path/to/arvados/services/crunch
90 export PERLLIB=/path/to/arvados/sdk/perl/lib:/path/to/warehouse-apps/libwarehouse-perl/lib
91 export ARVADOS_API_HOST={{ site.arvados_api_host }}
92 export PYTHONPATH=/path/to/arvados/src/sdk/python
93 export CRUNCH_DISPATCH_LOCKFILE=/var/lock/crunch-dispatch
94
95 fuser -TERM -k $CRUNCH_DISPATCH_LOCKFILE || true
96
97 ## Only if your SSL cert is unverifiable:
98 # export ARVADOS_API_HOST_INSECURE=yes
99
100 cd /path/to/arvados/services/api
101 RAILS_ENV=production /usr/local/rvm/bin/rvm 2.0.0 do bundle exec ./script/crunch-dispatch.rb 2>&1
102 </pre>