Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Condor-users] Possible Limitation Condor vs Perl / IPC::open3
- Date: Mon, 28 Feb 2005 10:18:12 -0500
- From: "Dave Lajoie" <dlajoie@xxxxxxxxxxxxxxxxxxxx>
- Subject: RE: [Condor-users] Possible Limitation Condor vs Perl / IPC::open3
Erik, Filip, John
Here are the files
Submit file
____________________________________________
universe = vanilla
executable = C:\Perl\bin\perl.exe
Requirements = (Has_XSI42_Batch == TRUE) && (Memory >= 1024)
Rank = (machine == "DAVELAJ_M60.PRODUCTION")
output = $(Cluster).$(Process)_out.txt
error = $(Cluster).$(Process)_err.txt
log = $(Cluster).$(Process).log
notification = always
notify_user = dlajoie@xxxxxxxxxxxxxxxxxxxx
copy_to_spool = false
should_transfer_files = false
priority = 10
initialdir = C:\temp
arguments = C:\Condor\wrapper\xsibatch42_wrapper.pl
Queue
Perl Wrapper
__________________________________
use Config;
use IPC::Open3;
use sigtrap 'handler' => \&myINT, 'INT';
use sigtrap 'handler' => \&myTERM, 'TERM';
use sigtrap 'handler' => \&myKILL, 'KILL';
use sigtrap 'handler' => \&myAlarm, 'ALRM';
use sigtrap 'handler' => \&myPIPE, 'PIPE';
sub myAlarm
{
}
sub myPIPE
{
my $signame = shift;
print "\n caught SIG$signame";
exit(0);
}
sub myINT
{
my $signame = shift;
print "\n caught CONDOR::KILL \n";
killChildrenProc();
exit(0);
}
sub myKILL
{
my $signame = shift;
print "\n caught CONDOR::KILL \n";
killChildrenProc();
exit(0);
}
sub myTERM
{
my $signame = shift;
print "\n caught CONDOR::VACATE \n";
killChildrenProc();
exit(0);
}
sub killChildrenProc
{
if ( $Config::Config{'osname'} eq "MSWin32")
{
# first we must kill the shell
kill 9, $pid;
open(TLIST,"tasklist 2>&1|");
while(<TLIST>)
{
if ($_ =~ /^XSIBATCH.exe\s+(\d+)/)
{
push @tlist, $1;
}
}
kill 9, @tlist;
} elsif ( $Config::Config{'osname'} eq 'linux')
{
open(TLIST,"ps -eo pid,comm |");
while(<TLIST>)
{
if ($_ =~ /(\d+)\s+XSIBATCH/)
{
push @tlist, $1;
}
sort @tlist;
kill 9, @tlist;
}
}
}
$cmd = 'C:\Softimage\XSI_4.2\Application\bin\xsibatch.bat -r -scene
"C:\data\customers\condor_tests\Scenes\condor_render_test_v02.scn" -mb
off -startframe 1 -endframe 10 -verbose prog -skip false';
$pid = open3("<&STDIN", \*XSIPROC, \*XSIPROC, $cmd) or die "Cannot run
$cmd: + $!";
for(;;)
{
sleep 1;
$line_count = 0;
while(<XSIPROC>)
{
if ($_ =~ /^\'ERROR/i)
{
print STDERR "WRAPPER::PROCESS_ERROR " . $_;
} else
{
print STDOUT $_;
}
if ( $line_count++ > 10 )
{
last;
}
}
}
Here is a simpler test you can use to repro the problem
Submit file
______________________________________________________
universe = vanilla
executable = C:\Perl\bin\perl.exe
Requirements = (Has_XSI42_Batch == TRUE) && (Memory >= 1024)
Rank = (machine == "DAVELAJ_M60.PRODUCTION")
output = $(Cluster).$(Process)_out.txt
error = $(Cluster).$(Process)_err.txt
log = $(Cluster).$(Process).log
notification = always
notify_user = dlajoie@xxxxxxxxxxxxxxxxxxxx
copy_to_spool = false
should_transfer_files = false
priority = 10
initialdir = C:\temp
arguments = C:\Condor\wrapper\test.pl
Queue
Test.pl
________________________________________________________
$cmd = 'ping -n 10000 localhost |';
$pid = open(XSIPROC,$cmd) ;
# or die "Cannot run $cmd: + $!";
for(;;)
{
sleep 1;
$line_count = 0;
while(<XSIPROC>)
{
print $_;
if ( $line_count++ > 10 )
{
last;
}
}
print "____\n";
}