Skip to content

Tasks are executed sequentially if user waits to confirm prompt #3364

Open
@moritz-makandra

Description

@moritz-makandra

Describe the Bug

I have a plan that first gathers data, shows the data to the user and then promt whether to to continue to run_task_with .

If the user confirms the promt immediately (<2min) the tasks called by run_task_with run in parallel as expected.

If the user waits longer than 2 minutes to confirm the dialog, the subsequent tasks run sequentially.

This is the structure of the plan in Question

plan example (
  String $groups = 'staging,production'
) {

  split($groups,/,/).each |TargetSpec $group| {
    $gather_information = run_task('fetch_data')
    $processed_information = process_data($gather_information)
    out::message($processed_information)
    if prompt("Proceed on group ${group}>?> [y/N]", 'default' => 'N') =~ /^[Yy]/) {
      $result = run_task_with('execute', keys($processed_information), _noop => $noop, '_catch_errors' => true) |$target| {
        {
          'defaults' = 'yes',
        }
      }
    }
  }
}

Expected Behavior

Run tasks in parallel, even if the user waits for some time to confirm the prompt

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run the plan above
  2. Wait for 3 minutes before answer the promt with y
  3. run ss -atp | grep :ssh | grep ESTAB | grep bolt to see the number of ssh sessions

Environment

  • Version 3.30.0

  • Ubuntu 22.04

Additional Context

  • target group size 30 - 200

bolt-project.yaml

concurrency: 20
plugin-cache:
  ttl: 1800

debug log

When the bug occurs only one Worker is logging like number 19 in this example.

On good runs there is more than one runner executing the tasks.

2024-11-27T11:25:39.658054 INFO   [exec-worker-19] [Bolt::Executor] Running task execute' on ["target.host.example.local"]
2024-11-27T11:25:39.658169 DEBUG  [exec-worker-19] [Bolt::Transport::SSH] Running task 'execute' on target.host.example.local with '{redacted}'
2024-11-27T11:25:43.817602 INFO   [exec-worker-19] [Bolt::Executor] {"target":"target.host.example.local","action":"task","object":"execute","status":"success","value":{redacted}}
2024-11-27T11:25:43.818384 INFO   [exec-worker-19] [Bolt::Executor] Running task execute' on ["another_target.host.example.local"]
2024-11-27T11:25:43.819116 DEBUG  [exec-worker-19] [Bolt::Transport::SSH] Running task 'execute' on another_target.host.example.local with '{redacted}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug reports and fixes.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions