RexOps / RexOps/Rex

host first vs task first task chaining

Open
#844 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

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 (https://github.com/RexOps/Rex/pull/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the refactor described in PR 849, then trace TaskList::Base->run(), TaskList->run(), and RunList->new->run_tasks(). The issue's staged plan covers separating task-first and host-first execution, adding feature flags and the -eo option, and updating summaries while keeping task-first as the default.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
cli, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.