# OOD 1.1.5 - Custom checkbox for exclusivity

**URL:** <https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589>\
**Category:** Get Help\
**Tags:** question\
**Created:** [November 7, 2019, 10:51pm UTC](https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589 "2019-11-07T22:51:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rengland](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/rengland/32/227_2.png) [@rengland](https://discourse.openondemand.org/u/rengland)\
**Post date:** [November 7, 2019, 10:51pm UTC](https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589/1 "2019-11-07T22:51:07Z")

</div>

I’m trying to configure a checkbox for some of my applications for users to request exclusive use of a node for running his/her Slurm job (i.e., the `--exclusive` option for `sbatch`.) I’ve been able to get the checkbox to appear on the submission form, but when I attempt to submit the job, I get errors. I am sure it’s because I don’t know what to put in my `submit.yml.erb` file, having been unable to find an example in Discourse that appears relevant. I’ve tried several different things, but here is my latest failure, which results in an Internal Server Error:

> ```
> ---
> batch_connect:
> template: vnc
> script:
> queue_name: <%= custom_queue %>
> native:
> - "-N"
> - "<%= bc_num_slots.blank? ? 1 : bc_num_slots.to_i %>"
> - "--ntasks-per-node"
> - "<%= bc_num_cores.blank? ? 1 : bc_num_cores.to_i %>"
> - "--mem"
> - "<%= bc_num_memory.blank? ? 6144 : bc_num_memory.to_i*1024 %>"
> - "--exclusive"
> - "<%= ! bc_exclusive.to_i.zero? ? 1 %><% unless bc_exclusive.blank %>"
> 
> ```

What do I need to do differently?

Thanks!

---

<div class="post-metadata">

**Author:** ![efranz](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/efranz/32/27_2.png) [@efranz](https://discourse.openondemand.org/u/efranz)\
**Post date:** [November 8, 2019, 12:56am UTC](https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589/2 "2019-11-08T00:56:57Z")

</div>

In this case I think we only want the flag added if `bc_exclusive.to_i == 1`. If checked, we include `- "--exclusive"`:

```auto
---
batch_connect:
  template: vnc
script:
  queue_name: <%= custom_queue %>
  native:
    - "-N"
    - "<%= bc_num_slots.blank? ? 1 : bc_num_slots.to_i %>"
    - "--ntasks-per-node"
    - "<%= bc_num_cores.blank? ? 1 : bc_num_cores.to_i %>"
    - "--mem"
    - "<%= bc_num_memory.blank? ? 6144 : bc_num_memory.to_i*1024 %>"
    <%= '- "--exclusive"' if bc_exclusive.to_i == 1 %>

```

Notice the `<%=` is lined up with the previous line’s `-`. You might also be able to do either of these below, though I wasn’t able to test this successfully from the command line, because Rails adds these extra tags.

```auto
    - "--mem"
    - "<%= bc_num_memory.blank? ? 6144 : bc_num_memory.to_i*1024 %>"
    <%= '- "--exclusive"' if bc_exclusive.to_i == 1 -%>

```

- using `-%>` instead of `%>`

or

```auto
    - "--mem"
    - "<%= bc_num_memory.blank? ? 6144 : bc_num_memory.to_i*1024 %>"
    <%- if bc_exclusive.to_i == 1 -%>
    - "--exclusive"
    <%- end -%>

```

- more readable, and I think the `<%-` and `-%>` would prevent the extra whitespace

---

<div class="post-metadata">

**Author:** ![rengland](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/rengland/32/227_2.png) [@rengland](https://discourse.openondemand.org/u/rengland)\
**Post date:** [November 8, 2019, 2:52am UTC](https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589/3 "2019-11-08T02:52:45Z")

</div>

Clearly, I’m going to have to take some time to learn to write YAML code. With my current rudimentary knowledge, I wouldn’t have figured out the syntax you’ve shared, so I’m much obliged. I went with the second suggestion (I like “more readable”), and it works like a charm.

Thank you and the rest of the OOD community for your patience and support. I do believe I’m going to meet my deadline, which is tomorrow afternoon.

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:31pm UTC](https://discourse.openondemand.org/t/ood-1-1-5-custom-checkbox-for-exclusivity/589/4 "2022-05-26T15:31:24Z")

</div>


