Class: Actions::DeliverLongRunningTasksNotification

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/deliver_long_running_tasks_notification.rb

Instance Method Summary collapse

Methods inherited from EntryAction

#action_subject, all_action_names, #delay, #drop_all_locks!, #humanized_input, #resource_locks, serializer_class

Methods included from Helpers::Lock

#exclusive_lock!, #link!, #lock!

Methods included from Helpers::ArgsSerialization

#serialize_args

Methods inherited from Base

#already_running?, #humanized_errors, #humanized_input, #humanized_output, #notify_paused, #serializer_class, #task, #task_input, #task_output

Methods included from TaskSynchronization

included, #sync_execution_plan_to_task

Methods included from Helpers::LifecycleLogging

included, #log_task_state_change

Instance Method Details

#humanized_nameObject



18
19
20
# File 'app/lib/actions/deliver_long_running_tasks_notification.rb', line 18

def humanized_name
  _('Deliver notifications about long running tasks')
end

#plan(report) ⇒ Object



3
4
5
6
7
# File 'app/lib/actions/deliver_long_running_tasks_notification.rb', line 3

def plan(report)
  return if report.task_uuids.empty?

  plan_self report: report
end

#rescue_strategy_for_selfObject



22
23
24
# File 'app/lib/actions/deliver_long_running_tasks_notification.rb', line 22

def rescue_strategy_for_self
  ::Dynflow::Action::Rescue::Skip
end

#runObject



9
10
11
12
13
14
15
16
# File 'app/lib/actions/deliver_long_running_tasks_notification.rb', line 9

def run
  report = OpenStruct.new(input[:report])
  tasks = ForemanTasks::Task.where(id: report.task_uuids)
  report.user = User.current
  report.tasks = tasks
  ::UINotifications::Tasks::TasksRunningLong.new(report).deliver!
  TasksMailer.long_tasks(report).deliver_now
end