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

fix awsim myjobs initializers #276

Merged
merged 1 commit into from
Jan 8, 2025
Merged
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
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
Loading