Commit e44f6283 authored by Tamara El Naboulsi's avatar Tamara El Naboulsi Committed by ens-bwalts
Browse files

Making bacct options configurable according to cluster

parent a7bf0049
......@@ -36,6 +36,9 @@
"EBI" : {
"SubmissionOptions" : "",
"TotalRunningWorkersMax" : 10000
},
"codon" : {
"BacctExtraOptions" : "-f -"
}
},
"SGE" : {
......
......@@ -322,7 +322,8 @@ sub get_report_entries_for_process_ids {
unless ($self->config_get('AccountingDisabled')) {
while (my $pid_batch = join(' ', map { "'$_'" } splice(@_, 0, 20))) { # can't fit too many pids on one shell cmdline
my $cmd = "bacct -f - -l $pid_batch";
my $bacct_opts = $self->config_get('BacctExtraOptions') || "";
my $cmd = "bacct $bacct_opts -l $pid_batch";
# warn "LSF::get_report_entries_for_process_ids() running cmd:\n\t$cmd\n";
......@@ -348,7 +349,8 @@ sub get_report_entries_for_time_interval {
my $to_timepiece = Time::Piece->strptime($to_time, '%Y-%m-%d %H:%M:%S') + 2*ONE_MINUTE;
$to_time = $to_timepiece->strftime('%Y/%m/%d/%H:%M');
my $cmd = "bacct -f - -l -C $from_time,$to_time ".($username ? "-u $username" : '');
my $bacct_opts = $self->config_get('BacctExtraOptions') || "";
my $cmd = "bacct $bacct_opts -l -C $from_time,$to_time ".($username ? "-u $username" : '');
# warn "LSF::get_report_entries_for_time_interval() running cmd:\n\t$cmd\n";
......
......@@ -207,14 +207,15 @@ my $expected_bacct = {
};
$lsf_meadow->config_set("AccountingDisabled", 0);
my $bacct_opts = $lsf_meadow->config_get('BacctExtraOptions') || "";
lives_and( sub {
local $ENV{EHIVE_EXPECTED_BACCT} = '-f - -l 34 56[7]';
local $ENV{EHIVE_EXPECTED_BACCT} = $bacct_opts.'-l 34 56[7]';
my $h = $lsf_meadow->get_report_entries_for_process_ids(34, '56[7]');
is_deeply($h, $expected_bacct, 'Got bacct output');
}, 'Can call bacct on process_ids');
lives_and( sub {
local $ENV{EHIVE_EXPECTED_BACCT} = '-f - -l -C 2020/10/11/12:23,2020/12/12/23:58 -u kb3';
local $ENV{EHIVE_EXPECTED_BACCT} = $bacct_opts.'-l -C 2020/10/11/12:23,2020/12/12/23:58 -u kb3';
my $h = $lsf_meadow->get_report_entries_for_time_interval('2020-10-11 12:23:45', '2020-12-12 23:56:59', 'kb3');
is_deeply($h, $expected_bacct, 'Got bacct output');
}, 'Can call bacct on a date range');
......@@ -222,13 +223,13 @@ lives_and( sub {
$lsf_meadow->config_set("AccountingDisabled", 1);
lives_and( sub {
local $ENV{EHIVE_EXPECTED_BACCT} = '-f - -l 34 56[7]';
local $ENV{EHIVE_EXPECTED_BACCT} = $bacct_opts.'-l 34 56[7]';
my $h = $lsf_meadow->get_report_entries_for_process_ids(34, '56[7]');
is_deeply($h, {}, 'No bacct output when accounting disabled');
}, 'Suppressed bacct when AccountingDisabled when checking process_ids');
lives_and( sub {
local $ENV{EHIVE_EXPECTED_BACCT} = '-f - -l -C 2015/10/11/12:23,2015/12/12/23:58 -u kb3';
local $ENV{EHIVE_EXPECTED_BACCT} = $bacct_opts.'-l -C 2015/10/11/12:23,2015/12/12/23:58 -u kb3';
my $h = $lsf_meadow->get_report_entries_for_time_interval('2015-10-11 12:23:45', '2015-12-12 23:56:59', 'kb3');
is_deeply($h, {}, 'No bacct output when accounting disabled');
}, 'Suppressed bacct when AccountingDisabled when checking a date range');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment