class Inferno::Repositories::TestRuns
Public Instance Methods
find_latest_waiting_by_identifier(identifier)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 27 def find_latest_waiting_by_identifier(identifier) test_run_hash = self.class::Model .where(status: 'waiting') .where(identifier: identifier) .where { wait_timeout >= Time.now } .order(Sequel.desc(:updated_at)) .limit(1) .to_a &.first &.to_hash return nil if test_run_hash.nil? build_entity(test_run_hash) end
json_serializer_options()
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 8 def json_serializer_options { include: { results: results_repo.json_serializer_options } } end
last_test_run(test_session_id)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 44 def last_test_run(test_session_id) test_run_hash = self.class::Model .where(test_session_id: test_session_id) .order(Sequel.desc(:updated_at)) .limit(1) .to_a .map { |record| record.to_json_data(json_serializer_options).deep_symbolize_keys! } &.first &.to_hash return nil if test_run_hash.nil? build_entity(test_run_hash) end
mark_as_done(test_run_id)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 64 def mark_as_done(test_run_id) update(test_run_id, status: 'done') end
mark_as_no_longer_waiting(test_run_id)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 77 def mark_as_no_longer_waiting(test_run_id) update( test_run_id, status: 'queued', identifier: nil, wait_timeout: nil ) end
mark_as_running(test_run_id)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 60 def mark_as_running(test_run_id) update(test_run_id, status: 'running') end
mark_as_waiting(test_run_id, identifier, timeout)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 68 def mark_as_waiting(test_run_id, identifier, timeout) update( test_run_id, status: 'waiting', identifier: identifier, wait_timeout: Time.now + timeout.seconds ) end
results_for_test_run(test_run_id)
click to toggle source
# File lib/inferno/repositories/test_runs.rb, line 16 def results_for_test_run(test_run_id) test_run_hash = self.class::Model .find(id: test_run_id) .to_json_data(json_serializer_options) .deep_symbolize_keys! test_run_hash[:results] .map! { |result| results_repo.build_entity(result) } end