-
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.
- Loading branch information
Showing
2 changed files
with
23 additions
and
20 deletions.
There are no files selected for viewing
13 changes: 7 additions & 6 deletions
13
apps.awesim.org/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 | ||
|
30 changes: 16 additions & 14 deletions
30
apps.awesim.org/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 | ||
end |