Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to override category, subcategory, and metadata in subapps #3006

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion apps/dashboard/app/models/batch_connect/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class App
# @return [String, nil] sub app
attr_accessor :sub_app

delegate :type, :category, :subcategory, :metadata, to: :ood_app
delegate :type, to: :ood_app

# Raised when batch connect app components could not be found
class AppNotFound < StandardError; end
Expand Down Expand Up @@ -119,6 +119,18 @@ def tile
ood_app.tile.merge(form_config.fetch(:tile, {}))
end

def category
form_config.fetch(:category, ood_app.category)
end

def subcategory
form_config.fetch(:subcategory, ood_app.subcategory)
end

def metadata
ood_app.metadata.merge(form_config.fetch(:metadata, {}))
end

def link
OodAppLink.new(
# FIXME: better to use default_title and "" description
Expand Down
20 changes: 20 additions & 0 deletions apps/dashboard/test/fixtures/apps/bc_with_subapps/form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
description: BC with sub apps description

attributes:
desktop: "mate"
bc_vnc_idle: 0
bc_vnc_resolution:
required: true
node_type: null

form:
- bc_vnc_idle
- desktop
- bc_num_hours
- bc_num_slots
- node_type
- bc_account
- bc_queue
- bc_vnc_resolution
- bc_email_on_started
33 changes: 33 additions & 0 deletions apps/dashboard/test/fixtures/apps/bc_with_subapps/local/oakley.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
cluster: "oakley"
attributes:
desktop: "gnome"
bc_queue: null
bc_account:
help: "You can leave this blank if **not** in multiple projects."
node_type:
widget: select
label: "Node type"
help: |
- **any** - (*12 cores*) Chooses anyone of the available Oakley nodes.
This reduces the wait time as you have no requirements.
- **vis** - (*12 cores*) This node includes an NVIDIA Tesla M2070 GPU
with an X server running in the background. This allows for Hardware
Rendering with the GPU typically needed for 3D visualization using
VirtualGL. There are currently only 128 of these nodes on Oakley.
- **gpu** - (*12 cores*) This node includes an NVIDIA Tesla M2070 GPU
allowing for CUDA computations. There are currently only 128 of these
nodes on Oakley. These nodes don't start an X server, so visualization
with hardware rendering is not possible.
- **bigmem** - (*12 cores*) This Oakley node comes with 192GB of
available RAM. There are only 8 of these nodes on Oakley.
- **hugemem** - (*32 cores*) This Oakley node has 1TB of available RAM as
well as 32 cores. There is only 1 of these nodes on Oakley. A
reservation may be required to use this node.
options:
- ["any", ":ppn=12"]
- ["vis", ":ppn=12:vis:gpus=1"]
- ["gpu", ":ppn=12:gpus=1"]
- ["bigmem", ":ppn=12:bigmem"]
- ["hugemem", ":ppn=32:hugemem"]
submit: submit/pbs.yml.erb
41 changes: 41 additions & 0 deletions apps/dashboard/test/fixtures/apps/bc_with_subapps/local/owens.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "Owens Desktop"
description: "Owens Description"
icon: fa://clock
caption: 'gnome desktop on the owens cluster'
category: Interactive Apps Overridden
subcategory: Desktops Overridden
metadata:
department: Overridden
cluster: "owens"
attributes:
desktop: "gnome"
bc_queue: null
bc_account:
help: "You can leave this blank if **not** in multiple projects."
node_type:
widget: select
label: "Node type"
help: |
- **any** - (*12 cores*) Chooses anyone of the available Oakley nodes.
This reduces the wait time as you have no requirements.
- **vis** - (*12 cores*) This node includes an NVIDIA Tesla M2070 GPU
with an X server running in the background. This allows for Hardware
Rendering with the GPU typically needed for 3D visualization using
VirtualGL. There are currently only 128 of these nodes on Oakley.
- **gpu** - (*12 cores*) This node includes an NVIDIA Tesla M2070 GPU
allowing for CUDA computations. There are currently only 128 of these
nodes on Oakley. These nodes don't start an X server, so visualization
with hardware rendering is not possible.
- **bigmem** - (*12 cores*) This Oakley node comes with 192GB of
available RAM. There are only 8 of these nodes on Oakley.
- **hugemem** - (*32 cores*) This Oakley node has 1TB of available RAM as
well as 32 cores. There is only 1 of these nodes on Oakley. A
reservation may be required to use this node.
options:
- ["any", ":ppn=12"]
- ["vis", ":ppn=12:vis:gpus=1"]
- ["gpu", ":ppn=12:gpus=1"]
- ["bigmem", ":ppn=12:bigmem"]
- ["hugemem", ":ppn=32:hugemem"]
submit: submit/pbs.yml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Desktops
category: Interactive Apps
subcategory: Desktops
icon: fa://desktop
role: batch_connect
metadata:
institution: OSC
department: Engineering
10 changes: 8 additions & 2 deletions apps/dashboard/test/models/batch_connect/app_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def expected_clusters(*args)
end
end

test 'subapps can override title, description, icon, and caption from form' do
r = PathRouter.new('test/fixtures/usr/shared/bc_with_subapps/')
test 'subapps can override title, description, icon, caption, category, subcategory, and metadata from form' do
r = PathRouter.new('test/fixtures/apps/bc_with_subapps/')
app = BatchConnect::App.new(router: r)
sub_apps = app.sub_app_list

Expand All @@ -305,6 +305,9 @@ def expected_clusters(*args)
assert_equal'Desktops: Oakley', sub_apps[0].title
assert_equal'BC with sub apps description', sub_apps[0].description
assert_equal'fa://desktop', sub_apps[0].icon_uri
assert_equal'Interactive Apps', sub_apps[0].category
assert_equal'Desktops', sub_apps[0].subcategory
assert_equal({ 'institution' => 'OSC', 'department' => 'Engineering' }, sub_apps[0].metadata)
assert_nil sub_apps[0].caption

oakley_link = sub_apps[0].link
Expand All @@ -317,6 +320,9 @@ def expected_clusters(*args)
assert_equal'Owens Desktop', sub_apps[1].title
assert_equal'Owens Description', sub_apps[1].description
assert_equal'fa://clock', sub_apps[1].icon_uri
assert_equal'Interactive Apps Overridden', sub_apps[1].category
assert_equal'Desktops Overridden', sub_apps[1].subcategory
assert_equal({ 'institution' => 'OSC', 'department' => 'Overridden' }, sub_apps[1].metadata)
assert_equal'gnome desktop on the owens cluster', app.sub_app_list[1].caption

owens_link = sub_apps[1].link
Expand Down