Skip to content

Commit

Permalink
fix awsim myjobs initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Jan 8, 2025
1 parent e2dff57 commit cb4bd7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
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
end

0 comments on commit cb4bd7a

Please sign in to comment.