1 |
ahart |
1.1 |
#!/usr/bin/env perl
|
2 |
|
|
|
3 |
|
|
use strict;
|
4 |
|
|
use Fcntl;
|
5 |
|
|
|
6 |
|
|
sub isDone;
|
7 |
|
|
|
8 |
|
|
my $argc = @ARGV;
|
9 |
|
|
my $fullCommand = $ARGV[0];
|
10 |
|
|
my $command = $fullCommand;
|
11 |
|
|
$command =~ s/[[:space:]]*([^[:space:]]*).*/$1/;
|
12 |
|
|
my @clusters = @ARGV[1 .. $argc - 1];
|
13 |
|
|
my $clusters = join (" ", @clusters);
|
14 |
|
|
|
15 |
|
|
while (1)
|
16 |
|
|
{
|
17 |
|
|
sleep 60;
|
18 |
|
|
if (isDone ($clusters))
|
19 |
|
|
{
|
20 |
|
|
close (OUTPUT);
|
21 |
|
|
system ("$fullCommand > $command.out.$$ 2>&1");
|
22 |
|
|
last;
|
23 |
|
|
}
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
sub
|
27 |
|
|
isDone
|
28 |
|
|
{
|
29 |
|
|
my $clusters = shift;
|
30 |
|
|
|
31 |
|
|
my @condorQ = `LD_LIBRARY_PATH=/usr/lib64/condor:\$LD_LIBRARY_PATH condor_q $clusters`;
|
32 |
|
|
my $condorQ = @condorQ;
|
33 |
|
|
|
34 |
|
|
return ($condorQ == 4);
|
35 |
|
|
}
|