host first vs task first task chaining
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_subout ofTaskList->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
@SUMMARYlogic and shared variables fromFork::TaskandFork::ManagerintoTaskList::Base->build_child_coderef().
- Moved
- Refactor
TaskList::Base->run()- Rename
run()torun_task(). I think this will eventually be calledrun_task_first(). - Deprecate
run()? - Move all logic in
TaskList->run()andRunList->new->run_tasks()intoTaskList::Base->run_tasks()
- Rename
Then add new features
-
TaskList::Base->run_tasks()will callrun_host_first()orrun_task_first() - Warn about errors that happen in a child process?
- Add
host_first_execution_orderandtask_first_execution_orderfeature flags - Add
rex -eocommand line option - Change the summary output to reflect the users execution order preferences.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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