[Starcluster] connection.execute blocks
Justin Riley
jtriley at MIT.EDU
Thu Apr 15 21:08:21 EDT 2010
You're absolutely right. However, a good 'init' script should return after
starting the service and also background the service.
So, you have a couple of options:
1. Write a wrapper script around the DB command that blocks and backgrounds
and disowns the process. Something as simple as:
#!/bin/bash
command_that_starts_db &; disown
Then in your execute call, call the wrapper script rather than the db command
directly
2. Not sure if this will work or not, but you might also try doing this
directly (although having an init script is going to be useful in general for
restarting the service once logged in via ssh for example):
connection.execute('command_that_starts_db &; disown)
Hope that helps,
~Justin
On Thursday 15 April 2010 8:58:53 pm Dan Yamins wrote:
> I'm trying to write a plug in that starts database server on on of the
> nodes of my cluster.
>
> However, a line like this in my plugin:
>
> connection.execute('commands to start the DB')
>
> wont' work because the command to start the DB process doesn't return --
> not until the DB is killed -- so since connection.execute blocks, this
> never returns, and the rest of the execution of the plugin hangs.
>
> The same thing happens when I try to run the process in teh background,
> e.g.
>
> connection.execute('commands to start the DB &')
>
> Fundamentally this is because paramiko.channel.exec_commands blocks.
>
>
> What I should do?
>
More information about the StarCluster
mailing list