1# $Id$ 2 3$jobid = $ENV{"LSB_JOBID"}; 4if ($jobid eq "") { 5 exit(1); 6#die("LSB_JOBID not defined\n"); 7} 8#exit(1) unless open(LL,"cat /msrc/home/edo/cr1|"); 9exit(1) unless open(LL,"$bjobs -l $jobid|"); 10 $nproc=0; 11 $used=0; 12while (<LL>) { 13 chop; 14 ($field, $value) = split(/ :/); 15 if ($field =~ /(\d+\.\d+) min of */) { 16 $walllimit = $1*60; 17 } elsif ($field =~ /Started on (\d+) Hosts*/) { 18 $nproc = $1; 19 } elsif ($field =~ / *The CPU time used is (\d+) seconds./) { 20 $used = int($1/$nproc*1.05);} 21} 22 23close(LL); 24 25exit 1 unless (defined($used) &&defined($walllimit)); 26 27 28$left = $walllimit - $used; 29#print "wsec = $walllimit used = $used\n"; 30 31#print "The job has been running for $used seconds and has $left seconds remaining.\n"; 32 33print "$left\n" 34 35