@@ -46,7 +46,9 @@ =head1 DESCRIPTION
46
46
[" compute-node|N=s\@ " => " Limit results to the given compute node" , { default => [] }],
47
47
[" slurm" => " Interpret job IDs as Slurm job IDs" ],
48
48
[" count" => " Print a count of matching records only" ],
49
+ [" sort-by-ram" => " Sort by memory used" ],
49
50
[" n-jobs|n=i" => " Limit to the given number of jobs" , { default => 50 } ],
51
+ [" show-inactive-jobs" => " Include inactive cluster jobs" ],
50
52
[" parsable" => " Generate tab-delimited output" ],
51
53
[" no-header" => " Skip printing header" ],
52
54
[" help|h" => " Show this help message." ],
@@ -58,7 +60,7 @@ =head1 DESCRIPTION
58
60
my $dbh = DBI-> connect (" dbi:mysql:" . sched_db_name . " ;host=" . sched_db_host . " ;port=$port " ,
59
61
sched_db_user, sched_db_pass);
60
62
$dbh or die " Cannot connect to database: " . $DBI::errstr ;
61
- $dbh -> do(qq( SET time_zone = "+00:00") );
63
+ # $dbh->do(qq(SET time_zone = "+00:00"));
62
64
63
65
64
66
#
@@ -132,6 +134,10 @@ =head1 DESCRIPTION
132
134
}
133
135
134
136
my @sort = (' t.submit_time DESC' );
137
+ if ($opt -> sort_by_ram)
138
+ {
139
+ unshift (@sort , ' cj.maxrss DESC' );
140
+ }
135
141
my $sort = join (" , " , @sort );
136
142
137
143
my @ids ;
@@ -195,7 +201,10 @@ =head1 DESCRIPTION
195
201
push (@conds , " $field IN ($vals )" );
196
202
}
197
203
198
- push (@conds , " te.active = 1 or te.active IS NULL" );
204
+ if (!$opt -> show_inactive_jobs)
205
+ {
206
+ push (@conds , " te.active = 1 or te.active IS NULL" );
207
+ }
199
208
200
209
my $cond = join (" AND " , map { " ($_ )" } @conds );
201
210
@@ -231,7 +240,7 @@ =head1 DESCRIPTION
231
240
IF(finish_time != DEFAULT(finish_time) AND start_time != DEFAULT(start_time), timediff(finish_time, start_time), '') as elap,
232
241
t.output_path, t.output_file, t.params,
233
242
t.req_memory, t.req_cpu, t.req_runtime, t.user_metadata,
234
- cj.job_id, cj.job_status, cj.maxrss, cj.cluster_id, cj.nodelist
243
+ cj.job_id, cj.job_status, cj.maxrss, cj.cluster_id, cj.nodelist, te.active
235
244
$full_condition
236
245
ORDER BY $sort
237
246
$limit
@@ -283,6 +292,11 @@ =head1 DESCRIPTION
283
292
push (@cols , { title => " User metadata" });
284
293
}
285
294
295
+ if ($opt -> show_inactive_jobs)
296
+ {
297
+ push (@cols , { title => " Cjob active" });
298
+ }
299
+
286
300
push (@cols , map { { title => $_ } } @{$opt -> show_parameter});
287
301
push (@cols , map { { title => $_ } } @{$opt -> show_count});
288
302
@@ -374,6 +388,7 @@ =head1 DESCRIPTION
374
388
push (@row , $task -> {output_file }) if $opt -> show_output_file;
375
389
push (@row , $task -> {output_path }) if $opt -> show_output_path;
376
390
push (@row , $task -> {user_metadata }) if $opt -> show_user_metadata;
391
+ push (@row , $task -> {active }) if $opt -> show_inactive_jobs;
377
392
378
393
for my $p (@{$opt -> show_parameter})
379
394
{
0 commit comments