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

An exit in parallel execution exits from all hosts #384

Open
spurnaye opened this issue Dec 27, 2016 · 2 comments
Open

An exit in parallel execution exits from all hosts #384

spurnaye opened this issue Dec 27, 2016 · 2 comments

Comments

@spurnaye
Copy link

I am using sshkit for parallel execution of commands on several servers. If there is an exit on one of the servers, then the exception is raised and execution on all the servers stops.
As per the my requirements only that host should be skipped continuing other hosts. Can this be achieved with the current code?

Here is an example code

require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL

hosts = ['[email protected]', '[email protected]', '[email protected]']

on hosts, in: :parallel do |host|
	execute './script.sh'
	execute './script_with_exit.sh'
end
@mattbrictson
Copy link
Member

Hi, thanks for the question. You should also check on Stack Overflow to see if you get more answers there.

The requirement you describe is not possible with the current execution model of SSHKit, at least out of the box. You might be able to plug in your own custom runner to do this.

In other words, instead of this:

in: :parallel

You could write this:

in: ParallelIgnoringErrors

And define the runner as follows:

class ParallelIgnoringErrors < SSHKit::Runner::Abstract
  def execute
    # your custom execution logic goes here
  end
end

If you get it to work, let us know, and we can discuss whether this belongs in SSHKit and/or something that should be called out in the docs.

@leehambley
Copy link
Member

leehambley commented Dec 27, 2016 via email

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

3 participants