Class: Dipa::Coordinator

Inherits:
ApplicationRecord show all
Includes:
Models::CoordinatorStateAttributes, Models::Dumpable, Models::Loadable, Models::StateAttributeHandling
Defined in:
app/models/dipa/coordinator.rb

Constant Summary

Constants included from Models::StateAttributeHandling

Models::StateAttributeHandling::SHARED_CONTINUING_STATES, Models::StateAttributeHandling::SHARED_FINISHED_STATES

Constants included from Models::CoordinatorStateAttributes

Models::CoordinatorStateAttributes::COORDINATOR_EXTRA_CONTINUING_STATES, Models::CoordinatorStateAttributes::COORDINATOR_EXTRA_FINISHED_STATES

Instance Method Summary collapse

Methods included from Models::StateAttributeHandling

#failed_state?, #finished_state?

Methods included from Models::Loadable

#load_from_file

Methods included from Models::Dumpable

#dump_to_file

Instance Method Details

#all_agents_created_and_finished?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'app/models/dipa/coordinator.rb', line 64

def all_agents_created_and_finished?
  _all_agents_created? && _all_agents_finished?
end

#processing_timeout_reached?Boolean

Returns:

  • (Boolean)


74
75
76
77
78
# File 'app/models/dipa/coordinator.rb', line 74

def processing_timeout_reached?
  return false if coordinator_processing_timeout.zero?

  (started_at + coordinator_processing_timeout) < Time.current.floor(Dipa::DATETIME_PRECISION)
end

#resultObject



54
55
56
57
58
# File 'app/models/dipa/coordinator.rb', line 54

def result
  return unless finished?

  _result_from_agents
end

#sourceObject



60
61
62
# File 'app/models/dipa/coordinator.rb', line 60

def source
  load_from_file(attacher: :source_dump)
end

#timeout_reached?Boolean

Returns:

  • (Boolean)


68
69
70
71
72
# File 'app/models/dipa/coordinator.rb', line 68

def timeout_reached?
  return false if coordinator_timeout.zero?

  (created_at + coordinator_timeout) < Time.current.floor(Dipa::DATETIME_PRECISION)
end