Hi,
I having problems with a perl module implemented in Sun Grid Engine.
This perl module (script) continuously watches the state of jobs
submitted to my cluster.
Every job can reach some of these states:
r - run
t - transfer
q - queued
s - suspended
w - waiting
In order to identify the current state of any job, the module(script)
invokes the program 'qstat'. For instance, this is a regular output of
this command:
4426 0.55500 data jas r 03/15/2009 15:52:19
This output indicates that there is a job who owner is the 'jas' user,
with job id = 4426, submitted on 03/15/2009 15:52:19 and it is
running (r).
I wrote the following perl script:
#!/usr/bin/perl -w
$job_id = 4426;
my @x = grep(/^\s+$job_id\s/,`qstat`);
my @estado = split(/\s+/,$x[0]);
print $estado[5];
if ($estado[5] eq "r") {
print "ok";
} else {
print "bad";
}
and it works as I expect, it prints 'rok', while the program is
running.
Now, I have tried to modify the 'sge.pm' module (script), but when I
define a variable, for instance:
my @x = grep(/^\s+$job_id\s/,`qstat`);
and print the value of '@x' I got nothing.
Is there a perl trick to avoid that new variables can not store some
value?
I appreciate your comments,
PS: Please, I newbie with Perl, I have worked with C, Java and Grovy,
so patience with me. Thanks so much.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/