[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Condor-users] Possible Limitation Condor vs Perl / IPC::open3



Correction
	the perl script below is incorrect (uses ping as the process)
	the script should look like this instead	

$cmd = 'ping -n 10 localhost |';
$pid = open(XSIPROC,$cmd) or die "Cannot run $cmd: + $!";

while(<XSIPROC>)
{
	print $_;
}

I get the following error when submitting the file
Cannot run ping -n 10 localhost |: + Bad file descriptor at
C:\Condor\wrapper\test.pl line 2.

If I run it thru command line, it works.

C:\>perl c:\Condor\wrapper\test.pl

Pinging DAVELAJ_M60.PRODUCTION [127.0.0.1] with 32 bytes of data:

Reply from 127.0.0.1: bytes=32 time<1ms TTL=64
Reply from 127.0.0.1: bytes=32 time<1ms TTL=64

Dave.
| -----Original Message-----
| From: condor-users-bounces@xxxxxxxxxxx 
| [mailto:condor-users-bounces@xxxxxxxxxxx] On Behalf Of Dave Lajoie
| Sent: Monday, February 28, 2005 10:18 AM
| To: Condor-Users Mail List; Dave Lajoie
| 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";
| }
| 
| _______________________________________________
| Condor-users mailing list
| Condor-users@xxxxxxxxxxx
| https://lists.cs.wisc.edu/mailman/listinfo/condor-users
|