Class: Dipa::Agent

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

Constant Summary

Constants included from Models::StateAttributeHandling

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

Constants included from Models::AgentStateAttributes

Models::AgentStateAttributes::AGENT_EXTRA_CONTINUING_STATES, Models::AgentStateAttributes::AGENT_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

#processing_timeout_reached?Boolean

Returns:

  • (Boolean)


62
63
64
65
66
# File 'app/models/dipa/agent.rb', line 62

def processing_timeout_reached?
  return false if coordinator.agent_processing_timeout.zero?

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

#resultObject



46
47
48
49
50
# File 'app/models/dipa/agent.rb', line 46

def result
  return unless finished?

  load_from_file(attacher: :result_dump)
end

#sourceObject



52
53
54
# File 'app/models/dipa/agent.rb', line 52

def source
  load_from_file(attacher: :source_dump)
end

#timeout_reached?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
# File 'app/models/dipa/agent.rb', line 56

def timeout_reached?
  return false if coordinator.agent_timeout.zero?

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