[sos-devel] [RFC] wrap commands in /usr/bin/timeout when available

Bryn M. Reeves bmr at redhat.com
Tue Mar 20 18:32:25 UTC 2012


On 03/20/2012 06:21 PM, Jesse Jaggars wrote:
> Using `timeout` is great for our situation since it allows us to offer a
> shell to plugins (for easy pipelines). Also, there isn't much extra overhead
> since we are forking from python anyways.

That's true actually - I'd not thought of that extra side effect but
it's neat.

> The only major downside is that we will rely on the binary to implement
> the timeout mechanism for us. This means that we either have to
> implement alternative timeout methods for platforms that lack `timeout`
> or fail to supply a timeout on those platforms. This is no worse than we
> do today, so it's not much of a downside I don't suppose.

Also true.. I think the fallback approach sounds like a good idea. This
would also let us work on distributions that ship pre-7.x coreutils.
Although I'd like to get timeout backported into the older Red Hat stuff
we can still run into machines with outdated packages.

> Given that we will likely want to try to provide an alternative timeout
> method we should probably plan to plug in different implementations
> somehow. Currently the method to fork a subprocess and do some work is
> just a thin wrapper around subprocess.Popen. It would make sense to
> allow a Policy object to override this implementation, though that might
> be overkill for now since we can see if `timeout` exists and use it or
> just do what we do now and hope for the best.

If we're going to allow falling back on Linux hosts too I reckon this
might be the way to go - policies can then look for a usable binary and
decide which way to go. Or maybe it's better in the general plugin
support code.. dunno - I think I'd need to see how it looked.

Cheers,
Bryn.




More information about the sos-devel mailing list