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

4.0 upgrade #260

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
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
18 changes: 10 additions & 8 deletions apps.awesim.org/apps/activejobs/initializers/filter.rb
Original file line number Diff line number Diff line change
@@ -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
14 changes: 8 additions & 6 deletions apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.rb
Original file line number Diff line number Diff line change
@@ -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
48 changes: 28 additions & 20 deletions apps.awesim.org/apps/dashboard/initializers/ood.rb
Original file line number Diff line number Diff line change
@@ -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
17 changes: 0 additions & 17 deletions apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb

This file was deleted.

20 changes: 14 additions & 6 deletions apps.totalsim.us/apps/dashboard/initializers/ood.rb
Original file line number Diff line number Diff line change
@@ -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
16 changes: 0 additions & 16 deletions class.osc.edu/apps/dashboard/initializers/k8s_core.rb

This file was deleted.

30 changes: 16 additions & 14 deletions class.osc.edu/apps/dashboard/initializers/stats2480.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 10 additions & 8 deletions ondemand.osc.edu/apps/activejobs/initializers/filter.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
50 changes: 27 additions & 23 deletions ondemand.osc.edu/apps/dashboard/initializers/ood.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@

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')
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
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"

5 changes: 3 additions & 2 deletions ondemand.osc.edu/apps/dashboard/initializers/usr_sharing.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Configuration.app_sharing_facls_enabled = true

Rails.application.config.after_initialize do
Configuration.app_sharing_facls_enabled = true
end
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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
Loading