Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to run commands on remote @group aliases asynchronously. #5745

Open
theodejager opened this issue Mar 7, 2023 · 0 comments

Comments

@theodejager
Copy link

theodejager commented Mar 7, 2023

Feature Request

Is your feature request directly related to a specific, existing command?

Not a specific command, but the aliases feature that allows commands to be run (remotely) on multiple WordPress installations, in one go.

Describe your use case and the problem you are facing

When you use a @group alias to run a WP-CLI command on multiple installations, WP-CLI will loop through every alias sequentially until the list of aliases is complete. In many instances, the order / timing at which this happens is irrelevant to me, I'd just like the group operations to be done as soon as possible.

For example in wp-cli.yml, having 3 sites registered in one group:

@site-a:
  ssh: dev_user@a.com~/webapps/production
@site-b:
   ssh: dev_user@b.com~/webapps/production
@site-c:
   ssh: dev_user@c.com~/webapps/production
@group:
  - @site-a
  - @site-b
  - @site-c

wp @group plugin update --all

Will first run the command on @site-a, then @site-b and finally @site-c. However, these processes could be run at the same time because they are independent of each other and don't reply on the output/timing of the previous command to continue (at least from an "ssh into server, do task" x times perspective, not sure how / if it could be accomplished in PHP). On @group with many sites and long running commands, this would considerably speed up things.

Describe the solution you'd like

Perhaps an optional flag that can be passed on to commands when running them on @group aliases that will let WP-CLI know that the order of execution doesn't matter. Maybe with an optional timeout variable to set a deadline on the total/per alias execution time and collect eventual error outputs at the end.

wp @group plugin update --all --async

Inspired by this other issue Asynchronous Plugin installation, although that one is command specific and the technical impossibility is clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants