On 3/8/09 7:03 PM, S. Robert James wrote:
> Hi. We're beginning to scale our Capistrano config to multiple
> servers, and I've gotten stuck on a few points:
>
> 1. My understanding is that tasks themselves run only once, no matter
> how many servers and roles we have defined, just that "run", "sudo",
> and similar methods fork into each matching server/role. Is that
> correct?
Yeah, though "fork" is probably the wrong term. Basically, the command
is pushed to each matching server, and then Capistrano waits until all
servers have finished before moving to the next run command.
> So, if a task doesn't use "run" or the like, its invocation will be
> identical, even after we define multiple roles.
>
> Is that correct?
Possibly, but I'm not sure what you mean. :)
> 2. I also believe that "run" and similar methods will run, in
> parallel, on all servers that match the *current* task's roles, even
> if the current task was called by a task with a more limited set of
> roles. (If task :a calls :b, and :b does run, the run will happen on
> all of :b's roles, even if :a doesn't share them.) Is this correct
> also?
Right. "Server scope" is not inherited; it applies only to the curernt
task, not to tasks invoked from the current task.
> 3. What happens if a "run" invoked by a task fails on one server but
> not others? Is the whole task considered to have failed (and will then
> normally be aborted and have its rollback invoked)?
If a command fails on one server but not on others, an exception is
raised. If the command was invoked inside of a transaction (and the
exception was not caught anywhere), all registered rollback blocks will
be invoked.
Thus, even if a task has a rollback block registered, the rollback will
not be called unless a transaction is active. E.g.
task :foo do
transaction do
bar
baz
end
end
Any exception in bar or baz will cause associated rollbacks to be called.
- Jamis
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---