[torqueusers] limit
Garrick Staples
garrick at usc.edu
Thu Jun 4 12:24:22 MDT 2009
On Thu, Jun 04, 2009 at 05:56:50PM +0200, Juan José Pardo Navarro alleged:
> Hi all,
>
> how could I limit the time what a job is queueble (not running)?
There isn't a way within torque.
Here's a script for you to start with:
#!/usr/bin/perl
use strict;
use PBS qw/pbs_connect pbs_statjob pbs_default pbs_disconnect/;
use Date::Parse;
my $now=time();
my $con=pbs_connect("") or die;
my $status=pbs_statjob($con, $ARGV[0],[qw/etime job_state/], undef) or die;
my %jobctime=();
foreach (@{$status}) {
my $job = $_->{name};
my $etime=0;
my $ctime=0;
my $state=0;
foreach (@{$_->{attribs}}) {
if($_->{name} eq "etime") {
$ctime=str2time($_->{value});
}
if($_->{name} eq "job_state") {
$state=$_->{value};
}
}
if ($state eq "Q") {
$jobctime{$job}=$ctime;
}
}
pbs_disconnect($con);
foreach my $job (reverse sort keys %jobctime) {
print "$job ",int( ($now-$jobctime{$job})/60/60/24),"\n";
}
--
Garrick Staples, GNU/Linux HPCC SysAdmin
University of Southern California
The pro-disease movement: http://www.jennymccarthybodycount.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.supercluster.org/pipermail/torqueusers/attachments/20090604/ff2e7b9f/attachment.bin
More information about the torqueusers
mailing list