---
layout: default
navsection: installguide
title: Install the Crunch dispatcher

...



The dispatcher normally runs on the same host/VM as the API server.

h4. Perl SDK dependencies

Install the Perl SDK on the controller.

* See "Perl SDK":{{site.baseurl}}/sdk/perl/index.html page for details.

h4. Python SDK dependencies

Install the Python SDK and CLI tools on controller and all compute nodes.

* See "Python SDK":{{site.baseurl}}/sdk/python/sdk-python.html page for details.

h4. Likely crunch job dependencies

On compute nodes:

* @pip install --upgrade pyvcf@

h4. Redis

On controller:

* @apt-get install redis-server@

h4. Crunch user account

On compute nodes and controller:

* @adduser crunch@

The crunch user should have the same UID, GID, and home directory on all compute nodes and on the controller.

h4. Repositories

Crunch scripts must be in Git repositories in @/var/lib/arvados/git/*.git@ (or whatever is configured in @services/api/config/environments/production.rb@).

Once you have a repository with commits -- and you have read access to the repository -- you should be able to create a new job:

<pre>
read -rd $'\000' newjob <<EOF; arv job create --job "$newjob"
{"script_parameters":{"input":"f815ec01d5d2f11cb12874ab2ed50daa"},
 "script_version":"master",
 "script":"hash",
 "repository":"arvados"}
EOF
</pre>

Without getting this error:

<pre>
ArgumentError: Specified script_version does not resolve to a commit
</pre>

h4. Running jobs

* @services/api/script/crunch-dispatch.rb@ must be running.
* @crunch-dispatch.rb@ needs @services/crunch/crunch-job@ in its @PATH@.
* @crunch-job@ needs @sdk/perl/lib@ and @warehouse-apps/libwarehouse-perl/lib@ in its @PERLLIB@
* @crunch-job@ needs @ARVADOS_API_HOST@ (and, if necessary in a development environment, @ARVADOS_API_HOST_INSECURE@)

Example @/var/service/arvados_crunch_dispatch/run@ script:

<pre>
#!/bin/sh
set -e

rvmexec=""
## uncomment this line if you use rvm:
#rvmexec="/usr/local/rvm/bin/rvm-exec 2.1.1"

export PATH="$PATH":/path/to/arvados/services/crunch
export ARVADOS_API_HOST={{ site.arvados_api_host }}
export CRUNCH_DISPATCH_LOCKFILE=/var/lock/crunch-dispatch

fuser -TERM -k $CRUNCH_DISPATCH_LOCKFILE || true

## Only if your SSL cert is unverifiable:
# export ARVADOS_API_HOST_INSECURE=yes

cd /path/to/arvados/services/api
export RAILS_ENV=production
exec $rvmexec bundle exec ./script/crunch-dispatch.rb 2>&1
</pre>