From: Tyler Riddle Date: Wed, 3 Oct 2012 18:02:10 +0000 (-0700) Subject: per host ulimit and nice values are configurable X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5dea0e467eb8b5ee9d24f44a933499848620f400;p=scpubgit%2FSystem-Introspector.git per host ulimit and nice values are configurable --- diff --git a/lib/System/Introspector/Config.pm b/lib/System/Introspector/Config.pm index 560cba7..4275496 100644 --- a/lib/System/Introspector/Config.pm +++ b/lib/System/Introspector/Config.pm @@ -16,15 +16,12 @@ sub _build_config { } sub sudo_user { $_[0]->config->{sudo_user} } - sub groups { sort keys %{ $_[0]->config->{group} || {} } } - sub has_group { exists $_[0]->config->{group}{ $_[1] } } - sub host_logs { $_[0]->config->{host_logs} } - +sub host_ulimit { $_[0]->config->{host_ulimit} } +sub host_nice { $_[0]->config->{host_nice} } sub host_concurrency { $_[0]->config->{host_concurrency} } - sub watchdog_timeout { $_[0]->config->{watchdog_timeout} } my $_load_host_file = sub { diff --git a/lib/System/Introspector/Gatherer.pm b/lib/System/Introspector/Gatherer.pm index 41efe97..dceba95 100644 --- a/lib/System/Introspector/Gatherer.pm +++ b/lib/System/Introspector/Gatherer.pm @@ -64,10 +64,13 @@ sub new_from_spec { my ($user, $host, $sudo_user) = @arg{qw( user host sudo_user )}; my $sudo = defined($sudo_user) ? sprintf('%s@', $sudo_user) : undef; my $args = { introspectors => $arg{introspectors} }; + my %connection_args = ( + stderr => $arg{stderr_fh}, watchdog_timeout => $arg{watchdog_timeout}, + nice => $arg{nice}, ulimit => $arg{ulimit}, + ); Dlog_trace { "Arguments for gatherer object: $_" } $args; - my %connection_args = ( stderr => $arg{stderr_fh}, watchdog_timeout => $arg{watchdog_timeout} ); if (defined $host) { my $remote = join '@', grep defined, $user, $host; my $conn = Object::Remote::Connection->conn_from_spec($remote, %connection_args); diff --git a/lib/System/Introspector/State.pm b/lib/System/Introspector/State.pm index d48d8c7..43b54fe 100644 --- a/lib/System/Introspector/State.pm +++ b/lib/System/Introspector/State.pm @@ -177,9 +177,11 @@ sub _create_gatherer { } my $gatherer = System::Introspector::Gatherer->new_from_spec( - user => $self->user, stderr_fh => $stderr_fh, watchdog_timeout => $self->config->watchdog_timeout, + nice => $self->config->host_nice, + ulimit => $self->config->host_ulimit, + user => $self->user, host => $arg{host}, sudo_user => $arg{sudo} && $self->sudo_user, introspectors => $arg{introspectors},