-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added metrics widget to OOD demo app to deploy to Dev environments
- Loading branch information
Showing
24 changed files
with
189 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
custom_pages: | ||
metrics: | ||
rows: | ||
- columns: | ||
- width: 12 | ||
widgets: | ||
- "metrics/metrics" |
3 changes: 2 additions & 1 deletion
3
config/local/app_overrides/initializers/configuration_extension.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Create Slurm Data For Metrics | ||
Execute the following script to create jobs in Slurm and generate metrics data: | ||
- `/etc/ood/config/apps/ood/jobs/submit_jobs.sh` | ||
|
||
The script will take some time to complete. | ||
Check the status of the jobs in the active jobs page in OOD: https://localhost:33000/pun/sys/ood/activejobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
#SBATCH --time=00:05:00 | ||
#SBATCH --mail-type=NONE | ||
|
||
case $MODE in | ||
'stress') | ||
srun yes > /dev/null | ||
;; | ||
'sleep') | ||
srun sleep 120 | ||
;; | ||
'timeout') | ||
srun sleep 100000 | ||
;; | ||
*) | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
users='ood' | ||
opmodes='sleep stress timeout' | ||
|
||
for ((node_count=1; node_count <= 2; node_count++)); do | ||
for user in $users; do | ||
for mode in $opmodes; do | ||
su - ood -c "sbatch -n $node_count --job-name=$user_$script_$node_count --export='ALL,MODE='$mode /etc/ood/config/apps/ood/jobs/example_job.sbatch" | ||
done | ||
done | ||
done |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# CUSTOM VERSION OF THE config/application.rb FILE TO LOAD CUSTOMIZATIONS AS PLUGINS | ||
# EASIER TO DEPLOY AND DEVELOP LOCALLY | ||
require_relative 'boot' | ||
|
||
require "rails" | ||
# Pick the frameworks you want: | ||
require "active_model/railtie" | ||
require "active_job/railtie" | ||
# require "active_record/railtie" | ||
# require "active_storage/engine" | ||
require "action_controller/railtie" | ||
require "action_mailer/railtie" | ||
# require "action_mailbox/engine" | ||
# require "action_text/engine" | ||
require "action_view/railtie" | ||
# require "action_cable/engine" | ||
require "sprockets/railtie" | ||
require "rails/test_unit/railtie" | ||
|
||
# Require the gems listed in Gemfile, including any gems | ||
# you've limited to :test, :development, or :production. | ||
Bundler.require(*Rails.groups) | ||
|
||
module Dashboard | ||
class Application < Rails::Application | ||
# Initialize configuration defaults for originally generated Rails version. | ||
config.load_defaults(7.0) | ||
|
||
# Configuration for the application, engines, and railties goes here. | ||
# | ||
# These settings can be overridden in specific environments using the files | ||
# in config/environments, which are processed later. | ||
# | ||
# config.time_zone = "Central Time (US & Canada)" | ||
# config.eager_load_paths << Rails.root.join("extras") | ||
|
||
config.autoload_paths << Rails.root.join('lib') | ||
|
||
# Locales are handled in config/initializers/locales.rb. | ||
|
||
# Custom error pages | ||
config.exceptions_app = self.routes | ||
|
||
if ::Configuration.load_external_config? | ||
# Ensuring OOD initializers run last so that user's cannot override what we | ||
# specify unless we allow the override as well in our own initializers. | ||
config.paths["config/initializers"] << ::Configuration.config_root.join("initializers").to_s | ||
config.autoload_paths << ::Configuration.config_root.join("lib").to_s | ||
config.paths["app/views"].unshift ::Configuration.config_root.join("views").to_s | ||
end | ||
|
||
# Enable installed plugins | ||
plugins_dir = Pathname.new(ENV['OOD_PLUGINS_DIRECTORY'] || '/var/www/ood/apps/plugins') | ||
if plugins_dir.directory? | ||
plugins_dir.children.select(&:directory?).each do |installed_plugin| | ||
config.paths["config/initializers"] << installed_plugin.join("initializers").to_s | ||
config.autoload_paths << installed_plugin.join("lib").to_s | ||
config.paths["app/views"].unshift installed_plugin.join("views").to_s | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## IQSS Metrics Widget For OnDemand | ||
Open OnDemand metrics widget displaying information about fairshare, job status summary, memory, CPU, GPU, and time. Data is retrieved directly from Slurm using the `sacct` and `sshare` commands. | ||
|
||
The metrics widget consist of four panels: | ||
- Fairshare | ||
- CPU Jobs by state | ||
- GPU Jobs by state | ||
- Jobs Stats Summary | ||
|
||
### Implementation Summary | ||
The implementation consist of three components | ||
- OOD Slurm adapter extension | ||
- ./initializers/slurm_extension.rb | ||
- Metrics calculations utility classes | ||
- ./lib/slurm_metrics | ||
- Metrics widget templates | ||
- ./views/widgets/metrics | ||
|
||
### Deployment | ||
Using the customization feature from OnDemand, with the default location under: `/etc/ood/config/apps/dashboard` | ||
- copy `./initializers/slurm_extension.rb` into `/etc/ood/config/apps/dashboard/intializers` | ||
- copy `./lib/slurm_metrics` into `/etc/ood/config/apps/dashboard/lib` | ||
- copy `./views/widgets/metrics` into `/etc/ood/config/apps/dashboard/views/widgets` | ||
|
||
Restart the OnDemand application for the customizations to take effect. | ||
|
||
### Deployment With FASRC Puppet | ||
The widget components need to be deployed using FASRC Puppet control repo. We are already using the OOD Puppet module feature to add files to the OOD dashboard location to add/extend functionality: | ||
`openondemand::apps_config_source:` | ||
|
||
The folder that we are deploying is: `site-modules/profile/files/openondemand/common/apps_config` | ||
|
||
In the Puppet control repo, we need to add the files for the three components to the following folders: | ||
- site-modules/profile/files/openondemand/common/apps_config/dashboard/intializers | ||
- site-modules/profile/files/openondemand/common/apps_config/dashboard/lib | ||
- site-modules/profile/files/openondemand/common/apps_config/dashboard/views/widgets | ||
|
||
To review and test the new widget, we could use a custom page to display it. This is a sample configuration: | ||
https://github.com/hmdc/ondemand_development/blob/main/config/local/ondemand.d/metrics.yml | ||
|
||
This will create a custom page under: `/pun/sys/dashboard/custom/metrics |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
custom_pages: | ||
metrics: | ||
rows: | ||
- columns: | ||
- width: 12 | ||
widgets: | ||
- "metrics/metrics" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
### FASRC Puppet YAML Hierarchy | ||
```yaml | ||
hierarchy: | ||
- name: "Secret data (encrypted)" | ||
lookup_key: eyaml_lookup_key | ||
paths: | ||
- "nodes/%{trusted.certname}.yaml" | ||
- "secrets/%{trusted.certname}.yaml" | ||
- "nodes/%{hostname}.yaml" | ||
- "secrets/%{hostname_base}.yaml" | ||
- "nodes/%{hostname_base}.yaml" | ||
- "ib_islands/%{::ib_island}.yaml" | ||
- "vlans/%{vlan}.yaml" | ||
- "vlans/%{vlan}_%{facts.os.family}_%{facts.os.release.major}.yaml" | ||
- "cluster/%{cluster}.yaml" | ||
- "groups/%{group}.yaml" | ||
- "kempner_%{kempner}.yaml" | ||
- "datacenter/%{datacenter}/proxy_%{needs_proxy}.yaml" | ||
- "datacenter/%{datacenter}.yaml" | ||
- "security_level/level%{security_level}/%{facts.os.family}/%{facts.os.release.major}.yaml" | ||
- "os/%{facts.os.family}.yaml" | ||
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml" | ||
- 'common/mounts.yaml' | ||
- "common/is_virtual_%{is_virtual}.yaml" | ||
- 'common/common.yaml' | ||
- "secrets/common.yaml" | ||
``` |