desc "my task"
task :my_task, :roles => :cluster do
run "some command here"
run "some command here"
run "some command here"
run "some command here"
run "some command here"
run "some command here"
run "some command here"
end
When I call my_task each command runs one after the other, is there a
way to make Capistrano run them all at once instead of waiting for the
first one to finish then move to the next one?
> desc "my task" > task :my_task, :roles => :cluster do > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > end
> When I call my_task each command runs one after the other, is there a > way to make Capistrano run them all at once instead of waiting for the > first one to finish then move to the next one?
> Thanks, > Brian
> -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en
> desc "my task" > task :my_task, :roles => :cluster do > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > run "some command here" > end
> When I call my_task each command runs one after the other, is there a > way to make Capistrano run them all at once instead of waiting for the > first one to finish then move to the next one?
> Thanks, > Brian
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
I guess I don't want this to be a shell issue, these tasks aren't dependent on one another so I was hoping capistrano could run them all at the same time. What if I separate out each run " command " to its own cap task then can I run cap tasks in parellel?
On Sat, Nov 5, 2011 at 11:07 AM, Donovan Bray <donno...@gmail.com> wrote: > You can do anything that your shell can do.
> You have to first determine how you want the commands to exit in case one > command fails.
> run "a;b;c"
> In this case all commands will run regardless of exit code, the exit code > of the last command only will be returned to cap.
> run "a && b && c"
> Will run each command but will exit on the first failure
> run "cd /a && b; true"
> Will exit and not run b if it can't cd into a; > If it can cd into a then it will run b; but it will always report sucess > to cap; even if b fails.
> Fair warning sudo doesn't allow you to chain execution this way
> sudo "cd /a && b; true"
> Won't work as expected; but you could rewrite it as a run.
> run "cd /a && #{sudo} b; true"
> On Nov 5, 2011, at 5:22 AM, Brian Carpio <bcar...@thetek.net> wrote:
> > Lets say I have the following
> > desc "my task" > > task :my_task, :roles => :cluster do > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > end
> > When I call my_task each command runs one after the other, is there a > > way to make Capistrano run them all at once instead of waiting for the > > first one to finish then move to the next one?
> > Thanks, > > Brian
> > -- > > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > > * To post to this group, send email to capistrano@googlegroups.com > > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en
Commands runs serially in order specified, whether you do it via multiple command passed to the shell or not. Each command is sent in parallel via ssh to all servers specified.
What exactly do you mean in parallel?
On Nov 5, 2011, at 12:33 PM, Brian Carpio <bcar...@thetek.net> wrote:
> I guess I don't want this to be a shell issue, these tasks aren't dependent on one another so I was hoping capistrano could run them all at the same time. What if I separate out each run " command " to its own cap task then can I run cap tasks in parellel?
> Thanks, > Brian
> On Sat, Nov 5, 2011 at 11:07 AM, Donovan Bray <donno...@gmail.com> wrote: > You can do anything that your shell can do.
> You have to first determine how you want the commands to exit in case one command fails.
> run "a;b;c"
> In this case all commands will run regardless of exit code, the exit code of the last command only will be returned to cap.
> run "a && b && c"
> Will run each command but will exit on the first failure
> run "cd /a && b; true"
> Will exit and not run b if it can't cd into a; > If it can cd into a then it will run b; but it will always report sucess to cap; even if b fails.
> Fair warning sudo doesn't allow you to chain execution this way
> sudo "cd /a && b; true"
> Won't work as expected; but you could rewrite it as a run.
> run "cd /a && #{sudo} b; true"
> On Nov 5, 2011, at 5:22 AM, Brian Carpio <bcar...@thetek.net> wrote:
> > Lets say I have the following
> > desc "my task" > > task :my_task, :roles => :cluster do > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > run "some command here" > > end
> > When I call my_task each command runs one after the other, is there a > > way to make Capistrano run them all at once instead of waiting for the > > first one to finish then move to the next one?
> > Thanks, > > Brian
> > -- > > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > > * To post to this group, send email to capistrano@googlegroups.com > > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
So I am attempting to reduce the downtime of our deployments, in one such case I umount all database related mount points so I can take a snapshot on the SAN (this is all automated via capistrano using SAN APIs etc..) it would be nice if I could have one cap job which ran all 20 commands at exactly the same time, if that cap command failed I can deal with that in a paret script which controles the remounting of file systems etc... To me that is what "in parallel means" all the "run" tasks run at the same time.
On Sat, Nov 5, 2011 at 4:56 PM, Donovan Bray <donno...@gmail.com> wrote: > What difference does it make?
> Commands runs serially in order specified, whether you do it via multiple > command passed to the shell or not. Each command is sent in parallel via > ssh to all servers specified.
> What exactly do you mean in parallel?
> On Nov 5, 2011, at 12:33 PM, Brian Carpio <bcar...@thetek.net> wrote:
> I guess I don't want this to be a shell issue, these tasks > aren't dependent on one another so I was hoping capistrano could run them > all at the same time. What if I separate out each run " command " to its > own cap task then can I run cap tasks in parellel?
> Thanks, > Brian
> On Sat, Nov 5, 2011 at 11:07 AM, Donovan Bray < <donno...@gmail.com> > donno...@gmail.com> wrote:
>> You can do anything that your shell can do.
>> You have to first determine how you want the commands to exit in case one >> command fails.
>> run "a;b;c"
>> In this case all commands will run regardless of exit code, the exit code >> of the last command only will be returned to cap.
>> run "a && b && c"
>> Will run each command but will exit on the first failure
>> run "cd /a && b; true"
>> Will exit and not run b if it can't cd into a; >> If it can cd into a then it will run b; but it will always report sucess >> to cap; even if b fails.
>> Fair warning sudo doesn't allow you to chain execution this way
>> sudo "cd /a && b; true"
>> Won't work as expected; but you could rewrite it as a run.
>> run "cd /a && #{sudo} b; true"
>> On Nov 5, 2011, at 5:22 AM, Brian Carpio < <bcar...@thetek.net> >> bcar...@thetek.net> wrote:
>> > Lets say I have the following
>> > desc "my task" >> > task :my_task, :roles => :cluster do >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > end
>> > When I call my_task each command runs one after the other, is there a >> > way to make Capistrano run them all at once instead of waiting for the >> > first one to finish then move to the next one?
>> > Thanks, >> > Brian
>> > -- >> > * You received this message because you are subscribed to the Google >> Groups "Capistrano" group. >> > * To post to this group, send email to <capistrano@googlegroups.com> >> capistrano@googlegroups.com >> > * To unsubscribe from this group, send email to >> <capistrano%2Bunsubscribe@googlegroups.com> >> capistrano+unsubscribe@googlegroups.com For more options, visit this >> group at <http://groups.google.com/group/capistrano?hl=en> >> http://groups.google.com/group/capistrano?hl=en
>> -- >> * You received this message because you are subscribed to the Google >> Groups "Capistrano" group. >> * To post to this group, send email to <capistrano@googlegroups.com> >> capistrano@googlegroups.com >> * To unsubscribe from this group, send email to >> <capistrano%2Bunsubscribe@googlegroups.com> >> capistrano+unsubscribe@googlegroups.com For more options, visit this >> group at <http://groups.google.com/group/capistrano?hl=en> >> http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to <capistrano@googlegroups.com> > capistrano@googlegroups.com > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at <http://groups.google.com/group/capistrano?hl=en> > http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en
So leverage the power of your shell, you can run() something and pass the appropriate nohup/background command to ask your shell to run it in the background, which will leave cap free to move on to the next run() command, etc.
The only problem with that is although these 20 tasks aren't dependent on each other the next cap jobs need to wait for them to finish before they can run. I guess I can write in logic in cap to check the status of the jobs that where put into the background, make sure they are finished then run the next cap job.
On Tue, Nov 8, 2011 at 12:41 PM, Lee Hambley <lee.hamb...@gmail.com> wrote: > So leverage the power of your shell, you can run() something and pass the > appropriate nohup/background command to ask your shell to run it in the > background, which will leave cap free to move on to the next run() command, > etc.
> - Lee
> -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to > capistrano+unsubscribe@googlegroups.com For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en
You have 20 hosts you want the same command run OR 20 different commands on the same host?
If it's the former use roles and define all the servers then target the task to that role; if it's the latter then your going to need to push down a bash script that forks subshells;
On Nov 8, 2011, at 11:10 AM, Brian Carpio <bcar...@thetek.net> wrote:
> So I am attempting to reduce the downtime of our deployments, in one such case I umount all database related mount points so I can take a snapshot on the SAN (this is all automated via capistrano using SAN APIs etc..) it would be nice if I could have one cap job which ran all 20 commands at exactly the same time, if that cap command failed I can deal with that in a paret script which controles the remounting of file systems etc... To me that is what "in parallel means" all the "run" tasks run at the same time.
> Brian
> On Sat, Nov 5, 2011 at 4:56 PM, Donovan Bray <donno...@gmail.com> wrote: > What difference does it make?
> Commands runs serially in order specified, whether you do it via multiple command passed to the shell or not. Each command is sent in parallel via ssh to all servers specified.
> What exactly do you mean in parallel?
> On Nov 5, 2011, at 12:33 PM, Brian Carpio <bcar...@thetek.net> wrote:
>> I guess I don't want this to be a shell issue, these tasks aren't dependent on one another so I was hoping capistrano could run them all at the same time. What if I separate out each run " command " to its own cap task then can I run cap tasks in parellel?
>> Thanks, >> Brian
>> On Sat, Nov 5, 2011 at 11:07 AM, Donovan Bray <donno...@gmail.com> wrote: >> You can do anything that your shell can do.
>> You have to first determine how you want the commands to exit in case one command fails.
>> run "a;b;c"
>> In this case all commands will run regardless of exit code, the exit code of the last command only will be returned to cap.
>> run "a && b && c"
>> Will run each command but will exit on the first failure
>> run "cd /a && b; true"
>> Will exit and not run b if it can't cd into a; >> If it can cd into a then it will run b; but it will always report sucess to cap; even if b fails.
>> Fair warning sudo doesn't allow you to chain execution this way
>> sudo "cd /a && b; true"
>> Won't work as expected; but you could rewrite it as a run.
>> run "cd /a && #{sudo} b; true"
>> On Nov 5, 2011, at 5:22 AM, Brian Carpio <bcar...@thetek.net> wrote:
>> > Lets say I have the following
>> > desc "my task" >> > task :my_task, :roles => :cluster do >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > run "some command here" >> > end
>> > When I call my_task each command runs one after the other, is there a >> > way to make Capistrano run them all at once instead of waiting for the >> > first one to finish then move to the next one?
>> > Thanks, >> > Brian
>> > -- >> > * You received this message because you are subscribed to the Google Groups "Capistrano" group. >> > * To post to this group, send email to capistrano@googlegroups.com >> > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
>> -- >> * You received this message because you are subscribed to the Google Groups "Capistrano" group. >> * To post to this group, send email to capistrano@googlegroups.com >> * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
>> -- >> * You received this message because you are subscribed to the Google Groups "Capistrano" group. >> * To post to this group, send email to capistrano@googlegroups.com >> * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
Look into bash and forking; because the you can 'join' after all the forking action and return an overall success or failure to cap before it moves on.
On Nov 8, 2011, at 11:44 AM, Brian Carpio <bcar...@thetek.net> wrote:
> The only problem with that is although these 20 tasks aren't dependent on each other the next cap jobs need to wait for them to finish before they can run. I guess I can write in logic in cap to check the status of the jobs that where put into the background, make sure they are finished then run the next cap job.
> Brian
> On Tue, Nov 8, 2011 at 12:41 PM, Lee Hambley <lee.hamb...@gmail.com> wrote: > So leverage the power of your shell, you can run() something and pass the appropriate nohup/background command to ask your shell to run it in the background, which will leave cap free to move on to the next run() command, etc.
> - Lee > -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
> -- > * You received this message because you are subscribed to the Google Groups "Capistrano" group. > * To post to this group, send email to capistrano@googlegroups.com > * To unsubscribe from this group, send email to capistrano+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en