Class: Mamiya::Agent::Tasks::Notifyable

Inherits:
Abstract
  • Object
show all
Defined in:
lib/mamiya/agent/tasks/notifyable.rb

Direct Known Subclasses

Fetch, Prepare, Switch

Instance Attribute Summary

Attributes inherited from Abstract

#agent, #error, #logger, #task, #task_queue

Instance Method Summary collapse

Methods inherited from Abstract

#after, #before, #errored, identifier, #initialize, #raise_error?, #run, #task_id

Constructor Details

This class inherits a constructor from Mamiya::Agent::Tasks::Abstract

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mamiya/agent/tasks/notifyable.rb', line 7

def execute
  agent.trigger('task', action: 'start',
    task: task,
    coalesce: false,
  )

  super

ensure
  if error
    agent.trigger('task', action: 'error',
      error: error.class.name,
      task: task,
      coalesce: false,
    )
  else
    agent.trigger('task', action: 'finish',
      task: task,
      coalesce: false,
    )
  end
end