Commit e4dd9fad authored by MARGERY David's avatar MARGERY David Committed by Lucas Nussbaum
Browse files

Change query to increase performance of requests as per bug #7970

parent a31279a7
......@@ -195,7 +195,7 @@ module OAR
class << self
def active
where("state NOT IN ('Terminated', 'Error')")
where("state IN ('Waiting', 'Running')")
end # def active
def expanded
......
......@@ -80,7 +80,7 @@ describe OAR::Resource do
it "should return all nodes with status busy" do
OAR::Resource.status.select do |node, status|
status[:soft] == "busy"
end.map{|(node, status)| node}.should == ["paradent-9.rennes.grid5000.fr", "paradent-28.rennes.grid5000.fr", "paradent-31.rennes.grid5000.fr", "paradent-32.rennes.grid5000.fr", "paradent-33.rennes.grid5000.fr", "paradent-34.rennes.grid5000.fr", "paradent-35.rennes.grid5000.fr", "paradent-38.rennes.grid5000.fr", "paradent-39.rennes.grid5000.fr", "paradent-40.rennes.grid5000.fr", "paradent-41.rennes.grid5000.fr", "paradent-42.rennes.grid5000.fr", "paradent-43.rennes.grid5000.fr", "paradent-44.rennes.grid5000.fr", "paradent-45.rennes.grid5000.fr", "paradent-47.rennes.grid5000.fr", "paradent-48.rennes.grid5000.fr", "paradent-49.rennes.grid5000.fr", "paradent-50.rennes.grid5000.fr", "paradent-52.rennes.grid5000.fr", "paradent-53.rennes.grid5000.fr", "paradent-54.rennes.grid5000.fr", "paradent-55.rennes.grid5000.fr", "paradent-56.rennes.grid5000.fr", "paradent-57.rennes.grid5000.fr", "paradent-58.rennes.grid5000.fr", "paradent-59.rennes.grid5000.fr", "paradent-60.rennes.grid5000.fr", "paradent-61.rennes.grid5000.fr", "paradent-62.rennes.grid5000.fr", "paradent-63.rennes.grid5000.fr", "paradent-64.rennes.grid5000.fr", "parapide-10.rennes.grid5000.fr", "parapide-11.rennes.grid5000.fr", "parapide-12.rennes.grid5000.fr", "parapide-13.rennes.grid5000.fr", "parapide-14.rennes.grid5000.fr", "parapide-15.rennes.grid5000.fr", "parapide-16.rennes.grid5000.fr", "parapide-17.rennes.grid5000.fr", "parapide-18.rennes.grid5000.fr", "parapluie-9.rennes.grid5000.fr", "paramount-6.rennes.grid5000.fr", "paramount-7.rennes.grid5000.fr", "paramount-8.rennes.grid5000.fr", "paramount-9.rennes.grid5000.fr", "paramount-5.rennes.grid5000.fr", "parapide-1.rennes.grid5000.fr", "parapide-2.rennes.grid5000.fr", "parapide-3.rennes.grid5000.fr", "parapide-4.rennes.grid5000.fr", "parapide-5.rennes.grid5000.fr", "parapide-6.rennes.grid5000.fr", "parapide-7.rennes.grid5000.fr", "parapide-8.rennes.grid5000.fr", "parapide-9.rennes.grid5000.fr", "parapide-19.rennes.grid5000.fr", "parapide-20.rennes.grid5000.fr", "parapide-21.rennes.grid5000.fr", "parapide-22.rennes.grid5000.fr", "parapide-23.rennes.grid5000.fr", "parapide-24.rennes.grid5000.fr", "parapide-25.rennes.grid5000.fr", "paramount-4.rennes.grid5000.fr", "paramount-30.rennes.grid5000.fr", "paramount-32.rennes.grid5000.fr", "paramount-33.rennes.grid5000.fr"]
end.map{|(node, status)| node}.sort.should == ["paradent-9.rennes.grid5000.fr", "paradent-28.rennes.grid5000.fr", "paradent-31.rennes.grid5000.fr", "paradent-32.rennes.grid5000.fr", "paradent-33.rennes.grid5000.fr", "paradent-34.rennes.grid5000.fr", "paradent-35.rennes.grid5000.fr", "paradent-38.rennes.grid5000.fr", "paradent-39.rennes.grid5000.fr", "paradent-40.rennes.grid5000.fr", "paradent-41.rennes.grid5000.fr", "paradent-42.rennes.grid5000.fr", "paradent-43.rennes.grid5000.fr", "paradent-44.rennes.grid5000.fr", "paradent-45.rennes.grid5000.fr", "paradent-47.rennes.grid5000.fr", "paradent-48.rennes.grid5000.fr", "paradent-49.rennes.grid5000.fr", "paradent-50.rennes.grid5000.fr", "paradent-52.rennes.grid5000.fr", "paradent-53.rennes.grid5000.fr", "paradent-54.rennes.grid5000.fr", "paradent-55.rennes.grid5000.fr", "paradent-56.rennes.grid5000.fr", "paradent-57.rennes.grid5000.fr", "paradent-58.rennes.grid5000.fr", "paradent-59.rennes.grid5000.fr", "paradent-60.rennes.grid5000.fr", "paradent-61.rennes.grid5000.fr", "paradent-62.rennes.grid5000.fr", "paradent-63.rennes.grid5000.fr", "paradent-64.rennes.grid5000.fr", "parapide-10.rennes.grid5000.fr", "parapide-11.rennes.grid5000.fr", "parapide-12.rennes.grid5000.fr", "parapide-13.rennes.grid5000.fr", "parapide-14.rennes.grid5000.fr", "parapide-15.rennes.grid5000.fr", "parapide-16.rennes.grid5000.fr", "parapide-17.rennes.grid5000.fr", "parapide-18.rennes.grid5000.fr", "parapluie-9.rennes.grid5000.fr", "paramount-6.rennes.grid5000.fr", "paramount-7.rennes.grid5000.fr", "paramount-8.rennes.grid5000.fr", "paramount-9.rennes.grid5000.fr", "paramount-5.rennes.grid5000.fr", "parapide-1.rennes.grid5000.fr", "parapide-2.rennes.grid5000.fr", "parapide-3.rennes.grid5000.fr", "parapide-4.rennes.grid5000.fr", "parapide-5.rennes.grid5000.fr", "parapide-6.rennes.grid5000.fr", "parapide-7.rennes.grid5000.fr", "parapide-8.rennes.grid5000.fr", "parapide-9.rennes.grid5000.fr", "parapide-19.rennes.grid5000.fr", "parapide-20.rennes.grid5000.fr", "parapide-21.rennes.grid5000.fr", "parapide-22.rennes.grid5000.fr", "parapide-23.rennes.grid5000.fr", "parapide-24.rennes.grid5000.fr", "parapide-25.rennes.grid5000.fr", "paramount-4.rennes.grid5000.fr", "paramount-30.rennes.grid5000.fr", "paramount-32.rennes.grid5000.fr", "paramount-33.rennes.grid5000.fr"].sort
end # it "should return all nodes with status busy"
# abasu : test added to check new status values -- bug ref 5106
......
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