From: Luke Cole <luke@(email surpressed).au>
Subject: Re: Rush + Autodesk Cleaner?
   Date: Thu, 29 Mar 2007 21:50:51 -0400
Msg# 1512
View Complete Thread (12 articles) | All Threads
Last Next
Hi Greg,

[posted to rush.general]

	I advise taking rush out of the equation, and invoke your perl script
directly from DOS, so that the system() command invokes the bat script,
	and check for exit code behavior that way.

	Can you show us the scripts you currently have?

Here is the batch file (cleaner.bat):

CMD /C ""C:\Program Files\Autodesk\Cleaner XL 1.5\Cleaner XL" /I %1 / O %2 /D %3 /sources %4"
EXIT /B 0

And the perl script that I have been using for experimentation purposes:

#!/usr/bin/perl -w
#
use strict;
use Sys::Hostname;
use File::Path;
use File::Copy;
use File::Basename;
#
# Globals
#
#$G::tmpdir = "/var/tmp/";
$G::homedir = $ENV{HOME};
$G::dotrushdir = "$G::homedir/.rush";

#
# Main Render
#
sub MainRender {
system('I:\TVC_Tools\CleanerToolkit\bin\cleaner.bat "I:\TVC_Tools \CleanerToolkit\profiles\input\DV_PAL_4x3.ipt" "I:\TVC_Tools \CleanerToolkit\profiles\output\3GP_PAL_4x3.opt" "I:\TVC_Tools \CleanerToolkit\renders" I:\TVC_Tools\CleanerToolkit\test_data \test.mov')
}

#
# Main Submit
#
sub MainSubmit {
    my $tmp = $G::dotrushdir . "/submit.$$";

    unless (open (SUBMIT, ">$tmp" ) )
        { print "open(>$tmp): $!\n", exit(1); }
    print SUBMIT << "EOF";
title           CleanerTest
ram             2048
frames          1
logdir          //starfish.fuel/indian/TVC_Tools/CleanerToolkit/logs
command perl //starfish.fuel/indian/TVC_Tools/CleanerToolkit/ bin/rush_cleaner_script.pl -render
autodump        off
cpus            sparky=1\@99
EOF

#waitfor         -i %s
#waitforstate    done

    unless (close(SUBMIT) )
        { print "close($tmp): $1\n"; exit(1); }

    # Submit the job, parse out jobid
    my $out = `rush -submit spitfire < $tmp`; unlink ( $tmp );

    if ( $out =~ /RUSH_JOBID=(\S+)/ ) { $ENV{RUSH_JOBID} = $1; }
    else { print STDERR "$out\nSubmit failed.\n"; exit(1); }

    print "$ENV{RUSH_JOBID}\n";

    exit(0);
}


#
# MAIN FUNCTION
#
sub main {
    if (defined $ARGV[0] && $ARGV[0] eq "-render" ) {
        MainRender();
    } else {
        MainSubmit();
    }
}
main;


Luke Cole wrote:
My initial attempt involved a rush render script in perl that would call Cleaner in command line mode via the perl system() call. This would result in Cleaner launching and displaying an error dialog complaining about invalid syntax, even though the exact same command typed into the console (rather than invoking it programmatically from perl using system()) executes successfully

	What's the command being run?

The exact command being run looks something like this:

"C:\Program Files\Autodesk\Cleaner XL 1.5\Cleaner XL" /I "I:\TVC_Tools \CleanerToolkit\profiles\input\DV_PAL_4x3.ipt" /O "I:\TVC_Tools \CleanerToolkit\profiles\output\3GP_PAL_4x3.opt" /D "I:\TVC_Tools \CleanerToolkit\renders" /sources "I:\TVC_Tools\CleanerToolkit \test_data\test.mov"

	Possibly it's just a matter of using the correct quoting
	of the command being passed to system().

I'm not so familiar with Perl and windows, so I could have been doing something wrong - it looked like Perl's system() call was doing something to the arguments that follow the windows style flags "/I", "/O" etc, because when I ran the above command directly in the windows console, it worked, however when I tried to launch it through system(), Cleaner displayed that error dialog I mentioned, and complained that it couldn't find a suitable argument for the /I switch.

As a second attempt, I created a small DOS batch file containing the Cleaner command and invoked this from my rush render script, hence shielding perl from the evil windows command switches (which only appear inside the batch file). Calling the batch file from the perl script worked better - the job is queued up and renders on our Cleaner machine successfully, the output from Cleaner is captured in the rush logs, unfortunately however the batch file never seems to return once the Cleaner render has finished, and so the rush job runs forever.

I tried putting in an exit statement in my batch file after the call to cleaner to ensure that the correct return code is being generated, however it seems that this line never gets called when I execute the bat file from within my perl render script - when I run the batch file directly in the console instead, everything behaves as expected.

	What happens if you run the perl script from the command line?
	Maybe it's not rush, but perl's system()?

When I run the perl script directly from the command line, it runs to completion:

I:\TVC_Tools\CleanerToolkit\bin>perl rush_cleaner_script.pl -render

I:\TVC_Tools\CleanerToolkit\bin>CMD /C ""C:\Program Files\Autodesk \Cleaner XL 1. 5\Cleaner XL" /I "I:\TVC_Tools\CleanerToolkit\profiles\input \DV_PAL_4x3.ipt" /O "I:\TVC_Tools\CleanerToolkit\profiles\output\3GP_PAL_4x3.opt" /D "I: \TVC_Tools\C leanerToolkit\renders" /sources I:\TVC_Tools\CleanerToolkit\test_data \test.mov"
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 2% completed. ---
--- Progress: 3% completed. ---
--- Progress: 5% completed. ---
--- Progress: 6% completed. ---
--- Progress: 8% completed. ---
--- Progress: 9% completed. ---
--- Progress: 11% completed. ---
--- Progress: 13% completed. ---
--- Progress: 14% completed. ---
--- Progress: 16% completed. ---
--- Progress: 17% completed. ---
--- Progress: 19% completed. ---
--- Progress: 20% completed. ---
--- Progress: 22% completed. ---
--- Progress: 23% completed. ---
--- Progress: 25% completed. ---
--- Progress: 27% completed. ---
--- Progress: 28% completed. ---
--- Progress: 30% completed. ---
--- Progress: 31% completed. ---
--- Progress: 33% completed. ---
--- Progress: 35% completed. ---
--- Progress: 36% completed. ---
--- Progress: 37% completed. ---
--- Progress: 38% completed. ---
--- Progress: 40% completed. ---
--- Progress: 41% completed. ---
--- Progress: 43% completed. ---
--- Progress: 44% completed. ---
--- Progress: 46% completed. ---
--- Progress: 48% completed. ---
--- Progress: 49% completed. ---
--- Progress: 51% completed. ---
--- Progress: 52% completed. ---
--- Progress: 54% completed. ---
--- Progress: 55% completed. ---
--- Progress: 57% completed. ---
--- Progress: 58% completed. ---
--- Progress: 60% completed. ---
--- Progress: 61% completed. ---
--- Progress: 63% completed. ---
--- Progress: 64% completed. ---
--- Progress: 66% completed. ---
--- Progress: 68% completed. ---
--- Progress: 69% completed. ---
--- Progress: 71% completed. ---
--- Progress: 72% completed. ---
--- Progress: 74% completed. ---
--- Progress: 76% completed. ---
--- Progress: 77% completed. ---
--- Progress: 79% completed. ---
--- Progress: 80% completed. ---
--- Progress: 82% completed. ---
--- Progress: 83% completed. ---
--- Progress: 84% completed. ---
--- Progress: 86% completed. ---
--- Progress: 87% completed. ---
--- Progress: 89% completed. ---
--- Progress: 91% completed. ---
--- Progress: 93% completed. ---
--- Progress: 95% completed. ---
--- Progress: 96% completed. ---
--- Progress: 98% completed. ---
--- Processing Time: 00:01:17. ---
--- Task Processing Time: 00:01:08. ---
--- Progress: 99% completed. ---

I:\TVC_Tools\CleanerToolkit\bin>EXIT /B 0

I:\TVC_Tools\CleanerToolkit\bin>

When I submit it as a job to rush, the render runs to completion, however the batch file does not seem to return, and so the rush job continues to remain in the queue, with a "run" status, even though the render is actually finished.

For example, if I change the batch file to look like this:

CMD /C ""C:\Program Files\Autodesk\Cleaner XL 1.5\Cleaner XL" /I %1 / O %2 /D %3 /sources %4"
echo -- FINISHED
EXIT /B 0

And submit it to rush, I end up with a log file that looks like so:

--------------- Rush 102.42 --------------
--      Host: sparky
--       Pid: 2428
--     Title: CleanerTest
--     Jobid: spitfire.946
--     Frame: 0001
--     Tries: 0
--     Owner: lrcole (1031/1031)
-- RunningAs: netrender
--  Priority: 99
--      Nice: 10
--    Tmpdir: C:/TEMP/.RUSH_TMP.331
--   LogFile: //starfish.fuel/indian/TVC_Tools/CleanerToolkit/logs/0001
-- Command: perl //starfish.fuel/indian/TVC_Tools/CleanerToolkit/ bin/rush_cleaner_script.pl -render
--   Started: Fri Mar 30 11:43:55 2007
------------------------------------------

C:\TEMP\.RUSH_TMP.331>CMD /C ""C:\Program Files\Autodesk\Cleaner XL 1.5\Cleaner XL" /I "I:\TVC_Tools\CleanerToolkit\profiles\input \DV_PAL_4x3.ipt" /O "I:\TVC_Tools\CleanerToolkit\profiles\output \3GP_PAL_4x3.opt" /D "I:\TVC_Tools\CleanerToolkit\renders" /sources I: \TVC_Tools\CleanerToolkit\test_data\test.mov"
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 0% completed. ---
--- Progress: 1% completed. ---
--- Progress: 2% completed. ---
--- Progress: 4% completed. ---
--- Progress: 4% completed. ---
--- Progress: 5% completed. ---
--- Progress: 7% completed. ---
--- Progress: 8% completed. ---
--- Progress: 9% completed. ---
--- Progress: 11% completed. ---
--- Progress: 12% completed. ---
--- Progress: 13% completed. ---
--- Progress: 14% completed. ---
--- Progress: 15% completed. ---
--- Progress: 16% completed. ---
--- Progress: 17% completed. ---
--- Progress: 19% completed. ---
--- Progress: 20% completed. ---
--- Progress: 21% completed. ---
--- Progress: 22% completed. ---
--- Progress: 24% completed. ---
--- Progress: 25% completed. ---
--- Progress: 26% completed. ---
--- Progress: 27% completed. ---
--- Progress: 28% completed. ---
--- Progress: 29% completed. ---
--- Progress: 30% completed. ---
--- Progress: 31% completed. ---
--- Progress: 33% completed. ---
--- Progress: 34% completed. ---
--- Progress: 35% completed. ---
--- Progress: 36% completed. ---
--- Progress: 38% completed. ---
--- Progress: 39% completed. ---
--- Progress: 40% completed. ---
--- Progress: 41% completed. ---
--- Progress: 42% completed. ---
--- Progress: 44% completed. ---
--- Progress: 45% completed. ---
--- Progress: 46% completed. ---
--- Progress: 47% completed. ---
--- Progress: 48% completed. ---
--- Progress: 49% completed. ---
--- Progress: 51% completed. ---
--- Progress: 52% completed. ---
--- Progress: 53% completed. ---
--- Progress: 54% completed. ---
--- Progress: 55% completed. ---
--- Progress: 57% completed. ---
--- Progress: 58% completed. ---
--- Progress: 59% completed. ---
--- Progress: 60% completed. ---
--- Progress: 61% completed. ---
--- Progress: 62% completed. ---
--- Progress: 63% completed. ---
--- Progress: 64% completed. ---
--- Progress: 65% completed. ---
--- Progress: 66% completed. ---
--- Progress: 68% completed. ---
--- Progress: 69% completed. ---
--- Progress: 70% completed. ---
--- Progress: 71% completed. ---
--- Progress: 73% completed. ---
--- Progress: 74% completed. ---
--- Progress: 75% completed. ---
--- Progress: 76% completed. ---
--- Progress: 78% completed. ---
--- Progress: 79% completed. ---
--- Progress: 80% completed. ---
--- Progress: 81% completed. ---
--- Progress: 82% completed. ---
--- Progress: 84% completed. ---
--- Progress: 85% completed. ---
--- Progress: 86% completed. ---
--- Progress: 87% completed. ---
--- Progress: 89% completed. ---
--- Progress: 90% completed. ---
--- Progress: 92% completed. ---
--- Progress: 93% completed. ---
--- Progress: 95% completed. ---
--- Progress: 96% completed. ---
--- Progress: 98% completed. ---
--- Processing Time: 00:01:36. ---
--- Task Processing Time: 00:01:27. ---
--- Progress: 99% completed. ---

The echo command I added to the batch is never called.


I presume that this issue is due to the way the Win32 console behaves when invoked programmatically - I was wondering if there is some special trick that I need to get batch files working correctly with rush?

	Batch scripts should probably be run with:

		cmd /c \\path\to\foo.bat arg1 arg2

	In perl, you have to be sure to escape the backslashes correctly,
	so that the perl interpreter doesn't interpret the slashes as
	escape sequences (like \n, \e, etc)

	Show us what you have, and what command you're trying to run.
	(I myself am not familiar with the cleaner program)


---
Luke Cole
Research & Development

FUEL International
65 King St., Newtown, Sydney NSW, Australia 2042



Last Next