Sha256: 2e9dbbf96a466063c3197eccb4e81866d04fa771cc0dec68ca6a4fedae9da98d

Contents?: true

Size: 1.61 KB

Versions: 5

Compression:

Stored size: 1.61 KB

Contents

module Kaya
  module Results

    def self.all_results_for suite_id
      Kaya::Database::MongoConnector.results_for suite_id
    end

    def self.results_ids_for suite_id
      all_results_for(suite_id).map do |result|
        result["_id"]
      end
    end

    def self.all_results_ids
      Kaya::Database::MongoConnector.all_results_ids
    end

    def self.find_for key
      Kaya::Database::MongoConnector.find_results_for_key key
    end

    def self.find_for_status status
      Kaya::Database::MongoConnector.find_results_for_status status
    end

    def self.all_results
      Kaya::Database::MongoConnector.all_results
    end

    def self.find_all_for_key key
      Kaya::Database::MongoConnector.find_results_for_key key
    end

    def self.all_results_for_ip ip_address
      Kaya::Database::MongoConnector.find_results_for_ip ip_address
    end

    def self.results_for_suite_id_and_ip suite_id, ip
      Kaya::Database::MongoConnector.results_for_suite_id_and_ip suite_id, ip
    end

    def self.running_for_suite_id_and_ip? suite_id, ip
      results = self.results_for_suite_id_and_ip suite_id, ip
      not results.select do |res|
        res["status"]=="running"
      end.empty?
    end

    # Resets all results with running status
    def self.reset_defuncts
      Kaya::Database::MongoConnector.all_results.select do |result|
        ["started","running"].include? result["status"]
      end.each do |result|
        Kaya::Support::Processes.kill_by_result_id(result["_id"])
      end.each do |result|
        result = Kaya::Results::Result.get(result["_id"])
        result.reset!

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kaya-0.0.14 lib/kaya/results/results.rb
kaya-0.0.13 lib/kaya/results/results.rb
kaya-0.0.12 lib/kaya/results/results.rb
kaya-0.0.11 lib/kaya/results/results.rb
kaya-0.0.10 lib/kaya/results/results.rb