# \[solved\] Not able to change widget for bc\_queue (in bc\_desktop app config)

**URL:** <https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029>\
**Category:** Get Help\
**Tags:** question\
**Created:** [April 28, 2022, 10:25am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029 "2022-04-28T10:25:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose-d](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jose-d/32/703_2.png) [@jose-d](https://discourse.openondemand.org/u/jose-d)\
**Post date:** [April 28, 2022, 10:25am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/1 "2022-04-28T10:25:51Z")

</div>

when I’m trying to let user select queue name from drop-down widget aka “select”, I’m not able to do it with the default attribute `bc_queue`.

Example:

`/etc/ood/config/apps/bc_desktop/(redacted).yml`:

when using custom attribute (`bc_queue1`) - works as expected - I can see the “select” widget and select “cpu” or “gpu” partition:

```auto
attributes:
    bc_account: ''
    bc_email_on_started: 0
    bc_num_slots: 1
    desktop: xfce
    bc_queue1:
      label: Slurm partition
      widget: "select"
      value: "cpu"
      options:
        - ["normal","cpu"]
        - ["GPU","gpu"]
cluster: (redacted)
title: Cluster Desktop
form:
  - bc_queue1

```

when I’m using default attribute name (bc\_queue instead of bc\_queue1 above ):

```auto
attributes:
    bc_account: ''
    bc_email_on_started: 0
    bc_num_slots: 1
    desktop: xfce
    bc_queue:
      label: Slurm partition
      widget: "select"
      value: "cpu"
      options:
        - ["normal","cpu"]
        - ["GPU","gpu"]
cluster: (redacted)
title: Cluster Desktop
form:
  - bc_queue

```

i see just standard textbox and the `select` widget is ignored.

Is there any good reason for that?  
Isn’t that bug?

Indeed I’d prefer to use default attribute name because otherwise I’d be forced to use patched bc\_desktop. This is indeed not un-doable but I like to be aligned with upstream and not letting every `dnf update` break my setup.

cheers from Prague.

---

<div class="post-metadata">

**Author:** ![jose-d](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jose-d/32/703_2.png) [@jose-d](https://discourse.openondemand.org/u/jose-d)\
**Post date:** [April 28, 2022, 11:47am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/2 "2022-04-28T11:47:25Z")

</div>

ok, the solution was to create custom attribute of required type.  
So to modify bc\_desktop config `/etc/ood/config/apps/bc_desktop/(redacted).yml`:

```auto
attributes:
    bc_account: ''
    bc_email_on_started: 0
    bc_num_slots: 1
    bc_queue: null
    desktop: xfce
    slurm_partition:
      label: Slurm partition
      widget: "select"
      value: "cpu"
      options:
        - ["normal","cpu"]
        - ["GPU","gpu"]
cluster: (redacted)
title: Cluster Desktop
form:
  - slurm_partition
  - bc_vnc_idle
  - desktop
  - bc_account
  - bc_num_hours
  - bc_num_slots
  - node_type
  - bc_queue
  - bc_vnc_resolution
  - bc_email_on_started

submit: "submit/my_submit.yml.erb"

```

and create `/etc/ood/config/apps/bc_desktop/submit/my_submit.yml.erb` containing:

```auto
---
script:
  queue_name: <%= slurm_partition %>
  native:
   - "-N"
   - "<%= bc_num_slots.blank? ? 1 : bc_num_slots.to_i %>"

```

works. 🙂

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 28, 2022, 2:45pm UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/3 "2022-04-28T14:45:05Z")

</div>

`bc_queue` is hard coded to be just a text field. We can change that so that you can override it (we just did it with `bc_account` because it was hard coded too).

> <https://github.com/OSC/ondemand/blob/f2d596feec3b49273de46dfb571bf6ed8f4a7025/apps/dashboard/lib/smart_attributes/attributes/bc_queue.rb#L15-L17>

That said - we’re also looking into auto populating partition information. Do you only have those 2 partitions?

See here for more info on that.

> <https://github.com/OSC/ondemand/issues/1970>
>
> Feature request:
> I currently have a dashboard initializer \`apps/dashboard/initia…lizers/ood.rb\` which does;
> 
> \`\`\`ruby
> class SlurmData
> def self.accounts
> username = Etc.getlogin
> accounts = \[\]
> IO.popen 'sacctmgr -np show accounts withassoc format=account,user' do |io|
> io.each do |line|
> acc = line.split('|')
> if acc\[1\] == username
> accounts.append(acc\[0\])
> end
> end
> end
> return accounts
> end
> end
> \`\`\`
> 
> (which could of course be cleaned up (I think it should have used CurrentUser?), extended to fetch partitions, reservations, clusters. but I have not yet had any such need).
> 
> It lets me switch away from free text field as input and instead conveniently configure my apps to just do;
> 
> 
> \`\`\`yml
> bc\_account:
> widget: "select"
> options: \[\<%= SlurmData.accounts.join(', ') %\>\]
> ...
> \`\`\`
> 
> which conveniently only presents the user with valid options; and for most users there is just one option which gets auto-selected.
> 
> In fact, this seems so generally applicable, I can't think of a reason why you wouldn't always want to do it like this, having all of this just be the default behavior.
> Extending it to a multi cluster setup also seems feasible.
> 
> Is there any broader interest in this? I can work on a PR if there is (though my ruby is weak)
> 
> 
> 
> ┆Issue is synchronized with this \[Asana task\](https://app.asana.com/0/1201735133575781/1202171244970662) by \[Unito\](https://www.unito.io)

---

<div class="post-metadata">

**Author:** ![jose-d](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jose-d/32/703_2.png) [@jose-d](https://discourse.openondemand.org/u/jose-d)\
**Post date:** [April 29, 2022, 9:37am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/4 "2022-04-29T09:37:12Z")

</div>

> [@jeff.ohrstrom](#):
>
> That said - we’re also looking into auto populating partition information. Do you only have those 2 partitions?

I have more partitions at my cluster(s), but to bc\_desktop users, only ‘gpu’ and ‘cpu’ partititions are relevant - other partitions are just defining different (_worse_) QoS.

> [@jeff.ohrstrom](#):
>
> See here for more info on that.

Thanks, the trick there presented by @Micket with `apps/dashboard/initializers/ood.rb` is really nice.

It could be really useful to us to present eg. available Lmod/Easybuild software modules / conda environments, etc. to user in OOD gui. I have already one open request to implement `conda`/`venv` “bring-your-own” jupyterlab environment (conda+venv) so this can help me avoid hardcoding things into our Ansible.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 29, 2022, 1:56pm UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/5 "2022-04-29T13:56:46Z")

</div>

> [@jose-d](#):
>
> It could be really useful to us to present eg. available Lmod/Easybuild software modules

This is coming in 2.1. You can the features currently in nightly: [Features Currently in 3.1 Nightly · Issue #1780 · OSC/ondemand · GitHub](https://github.com/OSC/ondemand/issues/1780)

> [@jose-d](#):
>
> I have already one open request

Where? With us?

---

<div class="post-metadata">

**Author:** ![jose-d](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jose-d/32/703_2.png) [@jose-d](https://discourse.openondemand.org/u/jose-d)\
**Post date:** [May 2, 2022, 7:42am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/6 "2022-05-02T07:42:53Z")

</div>

> [@jeff.ohrstrom](#):
>
> Where? With us?

Ah, sorry for possibly unclear wording.  
I meant request of my user at my system, so it’s up to me to fix that and thanks to your hint above, I know how!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/osc/original/2X/b/bae70bd0ed39a3ae769c2108155f4cb3e9da8385.png) [@system](https://discourse.openondemand.org/u/system)\
**Post date:** [October 29, 2022, 7:43am UTC](https://discourse.openondemand.org/t/solved-not-able-to-change-widget-for-bc-queue-in-bc-desktop-app-config/2029/7 "2022-10-29T07:43:22Z")

</div>

Closed on October 29, 2022, 7:43am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
