Commit 41fc1320 authored by MARGERY David's avatar MARGERY David
Browse files

Resist jobs with bad moldable_ids (see #9998)

parent 3f41a677
......@@ -212,15 +212,18 @@ module OAR
options) do
usefull_jobs.
each{|job|
Rails.logger.warn "#{job} has a bad moldable_id" if job.moldable_id.nil? || job.moldable_id==0
active_jobs_by_moldable_id[job.moldable_id] = {
# using job.resources will generate a query by job,
# and eager loading (the :include => [:job_types, :resources] will not work
# for association defined by :finder_sql such a resources
# initialize resources to an empty set
:resources => Set.new,
:job => job
}
if job.moldable_id.nil? || job.moldable_id==0
Rails.logger.warn "job ##{job.job_id} has a bad moldable_id. State is #{job.state}, submitted at #{Time.at(job.submission_time)}; last message is: #{job.message}"
else
active_jobs_by_moldable_id[job.moldable_id] = {
# using job.resources will generate a query by job,
# and eager loading (the :include => [:job_types, :resources] will not work
# for association defined by :finder_sql such a resources
# initialize resources to an empty set
:resources => Set.new,
:job => job
}
end
}
end
# if there are jobs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment