1d078733fd3f3ebbc632e5cea3bda3e1f9e1d569
[arvados.git] / doc / install / crunch2-slurm / install-dispatch.html.textile.liquid
1 ---
2 layout: default
3 navsection: installguide
4 title: Install the SLURM dispatcher
5
6 ...
7
8 The SLURM dispatcher can run on any node that can submit requests to both the Arvados API server and the SLURM controller.  It is not resource-intensive, so you can run it on the API server node.
9
10 h2. Install the dispatcher
11
12 First, "add the appropriate package repository for your distribution":{{ site.baseurl }}/install/install-manual-prerequisites.html#repos.
13
14 On Red Hat-based systems:
15
16 <notextile>
17 <pre><code>~$ <span class="userinput">sudo yum install crunch-dispatch-slurm</span>
18 ~$ <span class="userinput">sudo systemctl enable crunch-dispatch-slurm</span>
19 </code></pre>
20 </notextile>
21
22 On Debian-based systems:
23
24 <notextile>
25 <pre><code>~$ <span class="userinput">sudo apt-get install crunch-dispatch-slurm</span>
26 </code></pre>
27 </notextile>
28
29 h2. Create a dispatcher token
30
31 Create a privileged Arvados API token for use by the dispatcher. If you have multiple dispatch processes, you should give each one a different token.  *On the API server*, run:
32
33 <notextile>
34 <pre><code>apiserver:~$ <span class="userinput">cd /var/www/arvados-api/current</span>
35 apiserver:/var/www/arvados-api/current$ <span class="userinput">sudo -u <b>webserver-user</b> RAILS_ENV=production bundle exec script/create_superuser_token.rb</span>
36 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
37 </code></pre>
38 </notextile>
39
40 h2. Configure the dispatcher
41
42 Set up crunch-dispatch-slurm's configuration directory:
43
44 <notextile>
45 <pre><code>~$ <span class="userinput">sudo mkdir -p /etc/arvados</span>
46 ~$ <span class="userinput">sudo install -d -o -root -g <b>crunch</b> -m 0750 /etc/arvados/crunch-dispatch-slurm</span>
47 </code></pre>
48 </notextile>
49
50 Edit @/etc/arvados/crunch-dispatch-slurm/crunch-dispatch-slurm.yml@ to authenticate to your Arvados API server, using the token you generated in the previous step.  Follow this YAML format:
51
52 <notextile>
53 <pre><code class="userinput">Client:
54   APIHost: <b>zzzzz.arvadosapi.com</b>
55   AuthToken: <b>zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz</b>
56 </code></pre>
57 </notextile>
58
59 This is the only configuration required by crunch-dispatch-slurm.  The subsections below describe optional configuration flags you can set inside the main configuration object.
60
61 h3. PollPeriod
62
63 crunch-dispatch-slurm polls the API server periodically for new containers to run.  The @PollPeriod@ option controls how often this poll happens.  Set this to a string of numbers suffixed with one of the time units @ns@, @us@, @ms@, @s@, @m@, or @h@.  For example:
64
65 <notextile>
66 <pre><code class="userinput">"PollPeriod": "3m30s"
67 </code></pre>
68 </notextile>
69
70 h3. SbatchArguments
71
72 When crunch-dispatch-slurm invokes @sbatch@, you can add switches to the command by specifying @SbatchArguments@.  You can use this to send the jobs to specific cluster partitions or add resource requests.  Set @SbatchArguments@ to an array of strings.  For example:
73
74 <notextile>
75 <pre><code class="userinput">"SbatchArguments": ["--partition=PartitionName"]
76 </code></pre>
77 </notextile>
78
79 h3. CrunchRunCommand: Dispatch to SLURM cgroups
80
81 If your SLURM cluster uses the @task/cgroup@ TaskPlugin, you can configure Crunch's Docker containers to be dispatched inside SLURM's cgroups.  This provides consistent enforcement of resource constraints.  To do this, add the following to your crunch-dispatch-slurm configuration:
82
83 <notextile>
84 <pre><code class="userinput">"CrunchRunCommand": ["crunch-run", "-cgroup-parent-subsystem=<b>memory</b>"]
85 </code></pre>
86 </notextile>
87
88 The choice of subsystem ("memory" in this example) must correspond to one of the resource types enabled in SLURM's @cgroup.conf@. Limits for other resource types will also be respected.  The specified subsystem is singled out only to let Crunch determine the name of the cgroup provided by SLURM.
89
90 {% include 'notebox_begin' %}
91
92 Some versions of Docker (at least 1.9), when run under systemd, require the cgroup parent to be specified as a systemd slice.  This causes an error when specifying a cgroup parent created outside systemd, such as those created by SLURM.
93
94 You can work around this issue by disabling the Docker daemon's systemd integration.  This makes it more difficult to manage Docker services with systemd, but Crunch does not require that functionality, and it will be able to use SLURM's cgroups as container parents.  To do this, "configure the Docker daemon on all compute nodes":install-compute-node.html#configure_docker_daemon to run with the option @--exec-opt native.cgroupdriver=cgroupfs@.
95
96 {% include 'notebox_end' %}
97
98 h2. Restart the dispatcher
99
100 {% include 'notebox_begin' %}
101
102 The crunch-dispatch-slurm package includes configuration files for systemd.  If you're using a different init system, you'll need to configure a service to start and stop a @crunch-dispatch-slurm@ process as desired.  The process should run from a directory where the @crunch@ user has write permission on all compute nodes, such as its home directory or @/tmp@.  You do not need to specify any additional switches or environment variables.
103
104 {% include 'notebox_end' %}
105
106 Restart the dispatcher to run with your new configuration:
107
108 <notextile>
109 <pre><code>~$ <span class="userinput">sudo systemctl restart crunch-dispatch-slurm</span>
110 </code></pre>
111 </notextile>