-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to 4.0 * update ondemand's initializers for 4.0 to use Rails.application.config.after_initialize blocks. * remove NavConfig class. * Unrelated to 4.0 - this also removes a few patches that are no longer needed.
- Loading branch information
Showing
13 changed files
with
133 additions
and
145 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
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
14
apps.awesim.org/apps/activejobs/initializers/ood_clusters_fix.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
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 |
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 |
---|---|---|
@@ -1,26 +1,32 @@ | ||
# 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' | ||
else | ||
idp = 'https://idp.osc.edu' | ||
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
17
apps.awesim.org/apps/dashboard/initializers/usr_router_patch.rb
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# hide all menu options | ||
NavConfig.categories = ['Files'] | ||
NavConfig.categories_whitelist=true | ||
Rails.application.config.after_initialize do | ||
|
||
# enable dev mode for all configured app developers | ||
Configuration.app_development_enabled = UsrRouter.base_path.directory? | ||
Configuration.app_sharing_facls_enabled = true | ||
# enable dev mode for all configured app developers | ||
Configuration.app_development_enabled = UsrRouter.base_path.directory? | ||
Configuration.app_sharing_facls_enabled = true | ||
end |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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
14
ondemand.osc.edu/apps/activejobs/initializers/ood_clusters_fix.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
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 |
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 |
---|---|---|
@@ -1,30 +1,32 @@ | ||
|
||
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' | ||
else | ||
idp = 'https://idp.osc.edu' | ||
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" | ||
|
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Configuration.app_sharing_facls_enabled = true | ||
|
||
Rails.application.config.after_initialize do | ||
Configuration.app_sharing_facls_enabled = true | ||
end |
13 changes: 7 additions & 6 deletions
13
ondemand.osc.edu/apps/myjobs/initializers/ood_appkit_pitzer_exp_fix.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
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 | ||
|
28 changes: 15 additions & 13 deletions
28
ondemand.osc.edu/apps/myjobs/initializers/workflow_presubmit_validation.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
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 |