diff --git a/lib/astute/server/dispatcher.rb b/lib/astute/server/dispatcher.rb index 8cc45fc3..30cb5910 100644 --- a/lib/astute/server/dispatcher.rb +++ b/lib/astute/server/dispatcher.rb @@ -93,7 +93,8 @@ module Astute :tasks_directory => data['args'].fetch('tasks_directory', {}), :tasks_metadata => data['args'].fetch('tasks_metadata', {}), :dry_run => data['args'].fetch('dry_run', false), - :noop_run => data['args'].fetch('noop_run', false) + :noop_run => data['args'].fetch('noop_run', false), + :debug => data['args'].fetch('debug', false) } ) rescue Timeout::Error diff --git a/lib/astute/task_cluster.rb b/lib/astute/task_cluster.rb index 20cd9834..ba2a7ce2 100644 --- a/lib/astute/task_cluster.rb +++ b/lib/astute/task_cluster.rb @@ -15,7 +15,7 @@ require 'fuel_deployment' module Astute class TaskCluster < Deployment::Cluster - attr_accessor :noop_run + attr_accessor :noop_run, :debug_run def initialize(id=nil) super diff --git a/lib/astute/task_deployment.rb b/lib/astute/task_deployment.rb index a6d2f42b..3aca786a 100644 --- a/lib/astute/task_deployment.rb +++ b/lib/astute/task_deployment.rb @@ -49,6 +49,7 @@ module Astute [] ) cluster.noop_run = deployment_options.fetch(:noop_run, false) + cluster.debug_run = deployment_options.fetch(:debug, false) cluster.node_statuses_transitions = tasks_metadata.fetch( 'node_statuses_transitions', @@ -70,6 +71,7 @@ module Astute end setup_fail_behavior(tasks_graph, cluster) + setup_debug_behavior(tasks_graph, cluster) setup_tasks(tasks_graph, cluster) setup_task_depends(tasks_graph, cluster) setup_task_concurrency(tasks_graph, cluster) @@ -117,6 +119,19 @@ module Astute end end + def setup_debug_behavior(tasks_graph, cluster) + return unless cluster.debug_run + tasks_graph.each do |node_id, tasks| + tasks.each do |task| + if task['parameters'].present? + task['parameters']['debug'] = true + else + task['parameters'] = { 'debug' => true } + end + end + end + end + def setup_tasks(tasks_graph, cluster) tasks_graph.each do |node_id, tasks| tasks.each do |task|