From 36cf91101155525384a80998bc25add3ac9b1944 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 10:40:13 -0400 Subject: [PATCH 01/10] update ondemand's initializers for 4.0 --- .../apps/activejobs/initializers/filter.rb | 18 ++++++------ .../initializers/ood_clusters_fix.rb | 14 ++++++---- .../apps/dashboard/initializers/ood.rb | 7 +++-- .../dashboard/initializers/usr_sharing.rb | 5 ++-- .../initializers/ood_appkit_pitzer_exp_fix.rb | 13 +++++---- .../workflow_presubmit_validation.rb | 28 ++++++++++--------- 6 files changed, 48 insertions(+), 37 deletions(-) diff --git a/ondemand.osc.edu/apps/activejobs/initializers/filter.rb b/ondemand.osc.edu/apps/activejobs/initializers/filter.rb index 4436f4c2..f92feee4 100644 --- a/ondemand.osc.edu/apps/activejobs/initializers/filter.rb +++ b/ondemand.osc.edu/apps/activejobs/initializers/filter.rb @@ -1,8 +1,10 @@ -# Add a filter by group option and insert it after the first option. -Filter.list.insert(1, Filter.new.tap { |f| - group = OodSupport::User.new.group.name - f.title = "Your Group's Jobs (#{group})" - f.filter_id = "group" - # N.B. Need to use :egroup here for now. My Oodsupport group name is 'appl' but job 'Account_Name' is 'PZS0002' - f.filter_block = Proc.new { |job| job.native[:egroup] == group || job.native[:group_name] == group || job.accounting_id.to_s.downcase == group.downcase } -}) +Rails.application.config.after_initialize do + # Add a filter by group option and insert it after the first option. + Filter.list.insert(1, Filter.new.tap { |f| + group = OodSupport::User.new.group.name + f.title = "Your Group's Jobs (#{group})" + f.filter_id = "group" + # N.B. Need to use :egroup here for now. My Oodsupport group name is 'appl' but job 'Account_Name' is 'PZS0002' + f.filter_block = Proc.new { |job| job.native[:egroup] == group || job.native[:group_name] == group || job.accounting_id.to_s.downcase == group.downcase } + }) +end \ No newline at end of file diff --git a/ondemand.osc.edu/apps/activejobs/initializers/ood_clusters_fix.rb b/ondemand.osc.edu/apps/activejobs/initializers/ood_clusters_fix.rb index 8b5d67cf..9b1582c2 100644 --- a/ondemand.osc.edu/apps/activejobs/initializers/ood_clusters_fix.rb +++ b/ondemand.osc.edu/apps/activejobs/initializers/ood_clusters_fix.rb @@ -1,7 +1,9 @@ -OodAppkit.clusters = OodCore::Clusters.new( - OodAppkit.clusters.reject { |cluster| [:quick_pitzer].include?(cluster.id) } -) +Rails.application.config.after_initialize do + OodAppkit.clusters = OodCore::Clusters.new( + OodAppkit.clusters.reject { |cluster| [:quick_pitzer].include?(cluster.id) } + ) -if defined?(OODClusters) - OODClusters = OodCore::Clusters.new(OodAppkit.clusters.select(&:job_allow?)) -end + if defined?(OODClusters) + OODClusters = OodCore::Clusters.new(OodAppkit.clusters.select(&:job_allow?)) + end +end \ No newline at end of file diff --git a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb index 62cd63f3..2a4126f9 100644 --- a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb +++ b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb @@ -15,8 +15,6 @@ def add_paths fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') -NavConfig.categories_whitelist=true - require 'socket' hostname = Socket.gethostname case hostname @@ -27,4 +25,9 @@ def add_paths else idp = 'https://idp.osc.edu' end + ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" + +Rails.application.config.after_initialize do + NavConfig.categories_whitelist=true +end \ No newline at end of file diff --git a/ondemand.osc.edu/apps/dashboard/initializers/usr_sharing.rb b/ondemand.osc.edu/apps/dashboard/initializers/usr_sharing.rb index d5f2fef8..1663dedc 100644 --- a/ondemand.osc.edu/apps/dashboard/initializers/usr_sharing.rb +++ b/ondemand.osc.edu/apps/dashboard/initializers/usr_sharing.rb @@ -1,2 +1,3 @@ -Configuration.app_sharing_facls_enabled = true - +Rails.application.config.after_initialize do + Configuration.app_sharing_facls_enabled = true +end diff --git a/ondemand.osc.edu/apps/myjobs/initializers/ood_appkit_pitzer_exp_fix.rb b/ondemand.osc.edu/apps/myjobs/initializers/ood_appkit_pitzer_exp_fix.rb index f48f7923..5d51d98e 100644 --- a/ondemand.osc.edu/apps/myjobs/initializers/ood_appkit_pitzer_exp_fix.rb +++ b/ondemand.osc.edu/apps/myjobs/initializers/ood_appkit_pitzer_exp_fix.rb @@ -1,7 +1,8 @@ -Rails.application.configure do |config| - ActiveSupport.on_load(:active_record) do - Workflow.where(batch_host: 'pitzer-exp').update_all(batch_host: 'pitzer') - Workflow.where(batch_host: 'owens-slurm').update_all(batch_host: 'owens') - end if Configuration.production_database_path.file? +Rails.application.config.after_initialize do + Rails.application.configure do |config| + ActiveSupport.on_load(:active_record) do + Workflow.where(batch_host: 'pitzer-exp').update_all(batch_host: 'pitzer') + Workflow.where(batch_host: 'owens-slurm').update_all(batch_host: 'owens') + end if Configuration.production_database_path.file? + end end - diff --git a/ondemand.osc.edu/apps/myjobs/initializers/workflow_presubmit_validation.rb b/ondemand.osc.edu/apps/myjobs/initializers/workflow_presubmit_validation.rb index e6bf620b..d385a27c 100644 --- a/ondemand.osc.edu/apps/myjobs/initializers/workflow_presubmit_validation.rb +++ b/ondemand.osc.edu/apps/myjobs/initializers/workflow_presubmit_validation.rb @@ -1,20 +1,22 @@ -# array_ids is not currently exported automatically from ood_core -require 'ood_core/job/array_ids' -require 'workflow' +Rails.application.config.after_initialize do + # array_ids is not currently exported automatically from ood_core + require 'ood_core/job/array_ids' + require 'workflow' -class Workflow - validate :task_count_may_not_exceed_max_job_array_tasks - MAX_JOB_ARRAY_TASKS = 1000 + class Workflow + validate :task_count_may_not_exceed_max_job_array_tasks + MAX_JOB_ARRAY_TASKS = 1000 - def task_count_may_not_exceed_max_job_array_tasks - if ! task_count_ok? - errors.add(:job_array_request, "must result in less than #{Workflow::MAX_JOB_ARRAY_TASKS} tasks.") + def task_count_may_not_exceed_max_job_array_tasks + if ! task_count_ok? + errors.add(:job_array_request, "must result in less than #{Workflow::MAX_JOB_ARRAY_TASKS} tasks.") + end end - end - def task_count_ok? - return true if (job_array_request.nil? || job_array_request.empty?) + def task_count_ok? + return true if (job_array_request.nil? || job_array_request.empty?) - OodCore::Job::ArrayIds.new(job_array_request).ids.size <= Workflow::MAX_JOB_ARRAY_TASKS + OodCore::Job::ArrayIds.new(job_array_request).ids.size <= Workflow::MAX_JOB_ARRAY_TASKS + end end end \ No newline at end of file From bb196ee441501c5ce5e1b289a67db37d403b4469 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 10:56:27 -0400 Subject: [PATCH 02/10] wrap this block --- .../apps/dashboard/initializers/ood.rb | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb index 2a4126f9..854e0c79 100644 --- a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb +++ b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb @@ -1,33 +1,33 @@ -def add_paths - OodFilesApp.candidate_favorite_paths.tap do |paths| - # add project space directories - projects = User.new.groups.map(&:name).grep(/^P./) - - # add scratch space directories - paths << Pathname.new("/fs/scratch/#{User.new.name}") - paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } +Rails.application.config.after_initialize do + def add_paths + OodFilesApp.candidate_favorite_paths.tap do |paths| + # add project space directories + projects = User.new.groups.map(&:name).grep(/^P./) + + # add scratch space directories + paths << Pathname.new("/fs/scratch/#{User.new.name}") + paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } - paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + end end -end -fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` -add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') - -require 'socket' -hostname = Socket.gethostname -case hostname -when /dev/ - idp = 'https://idp-dev.osc.edu' -when /test/ - idp = 'https://idp-test.osc.edu' -else - idp = 'https://idp.osc.edu' -end + fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` + add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') -ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" + require 'socket' + hostname = Socket.gethostname + case hostname + when /dev/ + idp = 'https://idp-dev.osc.edu' + when /test/ + idp = 'https://idp-test.osc.edu' + else + idp = 'https://idp.osc.edu' + end -Rails.application.config.after_initialize do NavConfig.categories_whitelist=true -end \ No newline at end of file +end + +ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" \ No newline at end of file From fa908cdc7946bbb09c048c02bcfb1aac675a4502 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 11:00:48 -0400 Subject: [PATCH 03/10] mv this out of the block --- .../apps/dashboard/initializers/ood.rb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb index 854e0c79..c8e694a1 100644 --- a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb +++ b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb @@ -16,18 +16,18 @@ def add_paths fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') - require 'socket' - hostname = Socket.gethostname - case hostname - when /dev/ - idp = 'https://idp-dev.osc.edu' - when /test/ - idp = 'https://idp-test.osc.edu' - else - idp = 'https://idp.osc.edu' - end - NavConfig.categories_whitelist=true end +require 'socket' +hostname = Socket.gethostname +case hostname +when /dev/ + idp = 'https://idp-dev.osc.edu' +when /test/ + idp = 'https://idp-test.osc.edu' +else + idp = 'https://idp.osc.edu' +end + ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" \ No newline at end of file From 92f53d6a690e608d2678090b7c469e5dfba25db1 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 11:19:27 -0400 Subject: [PATCH 04/10] put these in a block and only invoke NavConfig on test and prod --- .../apps/dashboard/initializers/ood.rb | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb index c8e694a1..d08b115f 100644 --- a/ondemand.osc.edu/apps/dashboard/initializers/ood.rb +++ b/ondemand.osc.edu/apps/dashboard/initializers/ood.rb @@ -16,18 +16,19 @@ def add_paths fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') - NavConfig.categories_whitelist=true -end + require 'socket' + hostname = Socket.gethostname + case hostname + when /dev/ + idp = 'https://idp-dev.osc.edu' + when /test/ + idp = 'https://idp-test.osc.edu' + NavConfig.categories_whitelist=true # TODO: need to remove when upgrading to 4.0 + else + idp = 'https://idp.osc.edu' + NavConfig.categories_whitelist=true # TODO: need to remove when upgrading to 4.0 + end -require 'socket' -hostname = Socket.gethostname -case hostname -when /dev/ - idp = 'https://idp-dev.osc.edu' -when /test/ - idp = 'https://idp-test.osc.edu' -else - idp = 'https://idp.osc.edu' + ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" end -ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" \ No newline at end of file From e9f0003b0f911827945b1e3a341413dd795b3625 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 11:40:12 -0400 Subject: [PATCH 05/10] upgrade awesim --- .../apps/activejobs/initializers/filter.rb | 18 +++---- .../initializers/ood_clusters_fix.rb | 14 +++--- .../apps/dashboard/initializers/ood.rb | 48 +++++++++++-------- 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/apps.awesim.org/apps/activejobs/initializers/filter.rb b/apps.awesim.org/apps/activejobs/initializers/filter.rb index 4436f4c2..f92feee4 100644 --- a/apps.awesim.org/apps/activejobs/initializers/filter.rb +++ b/apps.awesim.org/apps/activejobs/initializers/filter.rb @@ -1,8 +1,10 @@ -# Add a filter by group option and insert it after the first option. -Filter.list.insert(1, Filter.new.tap { |f| - group = OodSupport::User.new.group.name - f.title = "Your Group's Jobs (#{group})" - f.filter_id = "group" - # N.B. Need to use :egroup here for now. My Oodsupport group name is 'appl' but job 'Account_Name' is 'PZS0002' - f.filter_block = Proc.new { |job| job.native[:egroup] == group || job.native[:group_name] == group || job.accounting_id.to_s.downcase == group.downcase } -}) +Rails.application.config.after_initialize do + # Add a filter by group option and insert it after the first option. + Filter.list.insert(1, Filter.new.tap { |f| + group = OodSupport::User.new.group.name + f.title = "Your Group's Jobs (#{group})" + f.filter_id = "group" + # N.B. Need to use :egroup here for now. My Oodsupport group name is 'appl' but job 'Account_Name' is 'PZS0002' + f.filter_block = Proc.new { |job| job.native[:egroup] == group || job.native[:group_name] == group || job.accounting_id.to_s.downcase == group.downcase } + }) +end \ No newline at end of file diff --git a/apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.rb b/apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.rb index 8b5d67cf..9b1582c2 100644 --- a/apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.rb +++ b/apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.rb @@ -1,7 +1,9 @@ -OodAppkit.clusters = OodCore::Clusters.new( - OodAppkit.clusters.reject { |cluster| [:quick_pitzer].include?(cluster.id) } -) +Rails.application.config.after_initialize do + OodAppkit.clusters = OodCore::Clusters.new( + OodAppkit.clusters.reject { |cluster| [:quick_pitzer].include?(cluster.id) } + ) -if defined?(OODClusters) - OODClusters = OodCore::Clusters.new(OodAppkit.clusters.select(&:job_allow?)) -end + if defined?(OODClusters) + OODClusters = OodCore::Clusters.new(OodAppkit.clusters.select(&:job_allow?)) + end +end \ No newline at end of file diff --git a/apps.awesim.org/apps/dashboard/initializers/ood.rb b/apps.awesim.org/apps/dashboard/initializers/ood.rb index a69726ff..d08b115f 100644 --- a/apps.awesim.org/apps/dashboard/initializers/ood.rb +++ b/apps.awesim.org/apps/dashboard/initializers/ood.rb @@ -1,26 +1,34 @@ -# AweSim OOD config -def add_paths - OodFilesApp.candidate_favorite_paths.tap do |paths| - # add project space directories - projects = User.new.groups.map(&:name).grep(/^P./) - paths.concat projects.map { |p| Pathname.new("/fs/project/#{p}") } +Rails.application.config.after_initialize do + def add_paths + OodFilesApp.candidate_favorite_paths.tap do |paths| + # add project space directories + projects = User.new.groups.map(&:name).grep(/^P./) + + # add scratch space directories + paths << Pathname.new("/fs/scratch/#{User.new.name}") + paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } - # add scratch space directories - paths << Pathname.new("/fs/scratch/#{User.new.name}") - paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } - - # add ess scratch and project directories - paths.concat projects.map { |p| Pathname.new("/fs/ess/scratch/#{p}") } - paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + end end -end -fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` -add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') + fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` + add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') -# don't show develop dropdown unless you are setup for app sharing -Configuration.app_development_enabled = UsrRouter.base_path.directory? -Configuration.app_sharing_facls_enabled = true + require 'socket' + hostname = Socket.gethostname + case hostname + when /dev/ + idp = 'https://idp-dev.osc.edu' + when /test/ + idp = 'https://idp-test.osc.edu' + NavConfig.categories_whitelist=true # TODO: need to remove when upgrading to 4.0 + else + idp = 'https://idp.osc.edu' + NavConfig.categories_whitelist=true # TODO: need to remove when upgrading to 4.0 + end + + ENV['OOD_DASHBOARD_HELP_CUSTOM_URL'] = "#{idp}/realms/osc/account/#/security/linked-accounts" +end -NavConfig.categories_whitelist=true From c56f2bcf60e4b9f952fa11f93ff58a90a6702e52 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 11:40:22 -0400 Subject: [PATCH 06/10] upgrade totalsim --- .../apps/dashboard/initializers/ood.rb | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/apps.totalsim.us/apps/dashboard/initializers/ood.rb b/apps.totalsim.us/apps/dashboard/initializers/ood.rb index 62a47e15..6ebaa6d4 100644 --- a/apps.totalsim.us/apps/dashboard/initializers/ood.rb +++ b/apps.totalsim.us/apps/dashboard/initializers/ood.rb @@ -1,7 +1,15 @@ -# hide all menu options -NavConfig.categories = ['Files'] -NavConfig.categories_whitelist=true +Rails.application.config.after_initialize do + require 'socket' + hostname = Socket.gethostname -# enable dev mode for all configured app developers -Configuration.app_development_enabled = UsrRouter.base_path.directory? -Configuration.app_sharing_facls_enabled = true + # TODO: remove when upgrading to 4.0 + unless hostname =~ /dev/ + # hide all menu options + NavConfig.categories = ['Files'] + NavConfig.categories_whitelist=true + end + + # enable dev mode for all configured app developers + Configuration.app_development_enabled = UsrRouter.base_path.directory? + Configuration.app_sharing_facls_enabled = true +end \ No newline at end of file From ee29c9f5e3e7c9679b7a8517c427a622950b04a8 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 11:41:13 -0400 Subject: [PATCH 07/10] upgrade class for 4.0 --- .../apps/dashboard/initializers/k8s_core.rb | 16 ---------- .../apps/dashboard/initializers/stats2480.rb | 30 ++++++++++--------- 2 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 class.osc.edu/apps/dashboard/initializers/k8s_core.rb diff --git a/class.osc.edu/apps/dashboard/initializers/k8s_core.rb b/class.osc.edu/apps/dashboard/initializers/k8s_core.rb deleted file mode 100644 index 09c95f74..00000000 --- a/class.osc.edu/apps/dashboard/initializers/k8s_core.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'ood_core/job/adapters/kubernetes' -require 'ood_core/job/adapters/kubernetes/helper' - -# monkey patch until https://github.com/OSC/ood_core/pull/778 is released -class OodCore::Job::Adapters::Kubernetes::Helper - def secret_info_from_json(json_data) - data = json_data.to_h[:data] || {} - - info = data.symbolize_keys.each_with_object({}) do |data_kv, hash| - hash[data_kv[0]] = Base64.decode64(data_kv[1]) - rescue - next - end - { ood_connection_info: info } - end -end \ No newline at end of file diff --git a/class.osc.edu/apps/dashboard/initializers/stats2480.rb b/class.osc.edu/apps/dashboard/initializers/stats2480.rb index 5bae25f5..2d4e422d 100644 --- a/class.osc.edu/apps/dashboard/initializers/stats2480.rb +++ b/class.osc.edu/apps/dashboard/initializers/stats2480.rb @@ -1,18 +1,20 @@ -def add_paths - OodFilesApp.candidate_favorite_paths.tap do |paths| - # add project space directories - projects = User.new.groups.map(&:name).grep(/^P./) - paths.concat projects.map { |p| Pathname.new("/fs/project/#{p}") } +Rails.application.config.after_initialize do + def add_paths + OodFilesApp.candidate_favorite_paths.tap do |paths| + # add project space directories + projects = User.new.groups.map(&:name).grep(/^P./) + paths.concat projects.map { |p| Pathname.new("/fs/project/#{p}") } - # add scratch space directories - paths << Pathname.new("/fs/scratch/#{User.new.name}") - paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } + # add scratch space directories + paths << Pathname.new("/fs/scratch/#{User.new.name}") + paths.concat projects.map { |p| Pathname.new("/fs/scratch/#{p}") } - # add ess scratch and project directories - paths.concat projects.map { |p| Pathname.new("/fs/ess/scratch/#{p}") } - paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + # add ess scratch and project directories + paths.concat projects.map { |p| Pathname.new("/fs/ess/scratch/#{p}") } + paths.concat projects.map { |p| Pathname.new("/fs/ess/#{p}") } + end end -end -fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` -add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') + fs_outage = `grep node_file_test_failure /var/lib/node_exporter/textfile_collector/autofs-file-test.prom | grep -q ' 1'; echo $?` + add_paths if fs_outage.chomp == "1" && !File.exist?('/etc/ood/config/gpfs_outage') +end \ No newline at end of file From d95cfb18288b82db00b1c0d648f4342edcc37676 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 12:07:06 -0400 Subject: [PATCH 08/10] add this back --- .../apps/dashboard/initializers/k8s_core.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 class.osc.edu/apps/dashboard/initializers/k8s_core.rb diff --git a/class.osc.edu/apps/dashboard/initializers/k8s_core.rb b/class.osc.edu/apps/dashboard/initializers/k8s_core.rb new file mode 100644 index 00000000..09c95f74 --- /dev/null +++ b/class.osc.edu/apps/dashboard/initializers/k8s_core.rb @@ -0,0 +1,16 @@ +require 'ood_core/job/adapters/kubernetes' +require 'ood_core/job/adapters/kubernetes/helper' + +# monkey patch until https://github.com/OSC/ood_core/pull/778 is released +class OodCore::Job::Adapters::Kubernetes::Helper + def secret_info_from_json(json_data) + data = json_data.to_h[:data] || {} + + info = data.symbolize_keys.each_with_object({}) do |data_kv, hash| + hash[data_kv[0]] = Base64.decode64(data_kv[1]) + rescue + next + end + { ood_connection_info: info } + end +end \ No newline at end of file From dae7eee86a9ab52811f76a77dcc7fee3ed69ec7e Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 12:27:23 -0400 Subject: [PATCH 09/10] no we dont need this file --- .../apps/dashboard/initializers/k8s_core.rb | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 class.osc.edu/apps/dashboard/initializers/k8s_core.rb diff --git a/class.osc.edu/apps/dashboard/initializers/k8s_core.rb b/class.osc.edu/apps/dashboard/initializers/k8s_core.rb deleted file mode 100644 index 09c95f74..00000000 --- a/class.osc.edu/apps/dashboard/initializers/k8s_core.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'ood_core/job/adapters/kubernetes' -require 'ood_core/job/adapters/kubernetes/helper' - -# monkey patch until https://github.com/OSC/ood_core/pull/778 is released -class OodCore::Job::Adapters::Kubernetes::Helper - def secret_info_from_json(json_data) - data = json_data.to_h[:data] || {} - - info = data.symbolize_keys.each_with_object({}) do |data_kv, hash| - hash[data_kv[0]] = Base64.decode64(data_kv[1]) - rescue - next - end - { ood_connection_info: info } - end -end \ No newline at end of file From d53ec75297c93ded6c84c6b132e90bb341e479c8 Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Wed, 18 Sep 2024 15:21:48 -0400 Subject: [PATCH 10/10] rm unnessecary patch --- .../dashboard/initializers/usr_router_patch.rb | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb diff --git a/apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb b/apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb deleted file mode 100644 index 6431846e..00000000 --- a/apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb +++ /dev/null @@ -1,17 +0,0 @@ -class UsrRouter - def owner_title - return @owner_title if defined?(@owner_title) - - @owner_title ||= (Etc.getpwnam(owner).gecos || owner) - rescue - @owner_title = owner - end - - def caption - if owner_title == owner - "Shared by #{owner}" - else - "Shared by #{owner_title} (#{owner})" - end - end -end