Skip to content

host first vs task first task chaining #844

@kablamo

Description

@kablamo

Currently rex only supports task first task execution order. I want to add host first task execution order. Some goals for this issue:

  • Explain what this change will look like to the user.
  • Create a detailed plan to get there so I can do small incremental prs instead of one gigantic pr.

User interface

Command line options
Users will use the -eo option to indicate which execution order they prefer. The default value will be task-first for backwards compatibility. Next major version bump should probably flip that because host-first execution is faster and I believe its what users want though I have no data to back that up:

rex -eo host-first -G production deploy:product1
rex -eo task-first -G production deploy:product1

New rex feature flags
Users will also be able to specify a default execution order using the host_first_execution_order or task_first_execution_order` feature flags.

use Rex -feature => [qw/ host_first_execution_order /];

Task execution summary
Users will also see a summary of success/failure at the end of a rex run. The summary of failures will be sorted by host first when using host first execution. And it will be sorted by task first when using task first execution.

How to get there

Refactor some stuff first

  • Refactor TaskList::Base and TaskList::Parallel_ForkManager (Refactor Rex::TaskList. No functional change. #849)
    • Moved $forked_sub out of TaskList->run() and into its own function.
    • This function is now shared between Rex::TaskList::Base and TaskList::Parallel_ForkManager.
    • Removed functions from TaskList::Parallel_Forkmanager which are already in TaskList::Base.
    • Moved @SUMMARY logic and shared variables from Fork::Task and Fork::Manager into TaskList::Base->build_child_coderef().
  • Refactor TaskList::Base->run()
    • Rename run() to run_task(). I think this will eventually be called run_task_first().
    • Deprecate run()?
    • Move all logic in TaskList->run() and RunList->new->run_tasks()into TaskList::Base->run_tasks()

Then add new features

  • TaskList::Base->run_tasks() will call run_host_first() or run_task_first()
  • Warn about errors that happen in a child process?
  • Add host_first_execution_order and task_first_execution_order feature flags
  • Add rex -eo command line option
  • Change the summary output to reflect the users execution order preferences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions