module SmartProxyDynflowCore::Helpers
Public Instance Methods
cancel_task(task_id)
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 45 def cancel_task(task_id) execution_plan = world.persistence.load_execution_plan(task_id) cancel_events = execution_plan.cancel { :task_id => task_id, :canceled_steps_count => cancel_events.size } end
complete_task(task_id, params)
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 66 def complete_task(task_id, params) world.event(task_id, params['step_id'].to_i, ::ForemanTasksCore::Runner::ExternalEvent.new(params)) end
task_status(task_id)
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 51 def task_status(task_id) ep = world.persistence.load_execution_plan(task_id) ep.to_hash.merge(:actions => ep.actions.map(&:to_hash)) rescue KeyError => _e status 404 {} end
tasks_count(state)
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 59 def tasks_count(state) state ||= 'all' filter = state != 'all' ? { :filters => { :state => [state] } } : {} tasks = world.persistence.find_execution_plans(filter) { :count => tasks.count, :state => state } end
trigger_task(*args)
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 40 def trigger_task(*args) triggered = world.trigger(*args) { :task_id => triggered.id } end
world()
click to toggle source
# File lib/smart_proxy_dynflow_core/helpers.rb, line 3 def world SmartProxyDynflowCore::Core.world end