AWS Thinkbox Discussion Forums

Modo submit script mods

Here are my modifications on the modo script to make it work on windows (7)

This part is for adding a saving dialog (make sure user doesn’t overwrite version when he doesn’t want to

{
	# Save scene if necessary.
	my $sceneChanged = lxq( "query sceneservice scene.changed ? current" );
	if( $sceneChanged )
	{
		lx( "dialog.setup okCancel" );   // Beginning of Save confirmation procedure
		lx( "dialog.title {Save Needed}" );
		lx( "dialog.msg {This will save your scene before submit}" );
		lx( "dialog.open");
		$useragree = lxq( "dialog.result ?" );
		if ($useragree eq "ok")
		{
			lx( "scene.save" ); // original command
			lxout("scene saved");
		}
		else {
			return;
		}   // end of addon procedure
	}
}

This part changes two things :
Make the $deadlineBin globally available so it can be used later with START /D (which is needed now that Deadline is no more in the global PATH)
This also adds a $file variable which I substitute in Main submission script as default job name, instead of “untitled”

if( -e "/Users/Shared/Thinkbox/DEADLINE_PATH" )
{
	open my $file, '<', "/Users/Shared/Thinkbox/DEADLINE_PATH"; 
	my $deadlineBin = <$file>; 
	close $file;
	
	$deadlineBin =~ s/^\s*(.*)\s*$/$1/;
	$deadlinecommand = "$deadlineBin/deadlinecommand";
	$deadlinecommandbg = "$deadlineBin/deadlinecommandbg";
}
else
{
	$deadlineBin = $ENV{"DEADLINE_PATH"}; //was 	my $deadlineBin = $ENV{"DEADLINE_PATH"};
	$deadlinecommand = "$deadlineBin/deadlinecommand";
	$deadlinecommandbg = "$deadlineBin/deadlinecommandbg";
}

# Call DeadlineCommand to launch the monitor script file.
my $root = fix_path( `\"$deadlinecommand\" -getrepositoryroot` );
my $script = "$root/scripts/Submission/ModoSubmission.py";
lxout( "script: $script" );
($dir,$file) = $sceneFile =~ m|^(.*[/\\])([^/\\]+?)$|; // was not existing, is needed to extract file name
if( -e $script )
{
	`START \"\" /D \"$deadlineBin\" \"$deadlinecommandbg\" -executescript "$script" "$sceneFile" "$frameRange" "$file"`; // was `\"$deadlinecommandbg\" -executescript "$script" "$sceneFile" "$frameRange"`; adds START /D "" "DeadlineBin".... and $file
}
else
{
	my $scripterrmsg = "The ModoSubmission.py script could not be found in the Deadline Repository. Please make sure that the Deadline Client has been installed on this machine,\nthat the Deadline Client bin folder is set in the DEADLINE_PATH environment variable, and that the Deadline Client has been configured to point to a valid Repository.";
	error_dialog( $scripterrmsg );
	return;
}

Here is the modified code portion for : $RepositoryRoot/scipts/submission/ModoSubmission.py

	if len( args ) > 0:
		scriptDialog.SetValue( "SceneBox", args[0] )
		scriptDialog.SetValue( "FramesBox", args[1] )
		scriptDialog.SetValue( "NameBox", args[2] )
		appSubmission = True

This is the 1st time ever I touch PERL
This is the 1st time ever I touch LX (modo) language
I’m no programmer

feel free to comment, use, and upgrade

Thanks! We’ll change the submission script to auto-set the job name based on the scene name, but we’ll do it all in the ModoSubmission.py file by pulling the scene name from the first argument.

Out of curiosity, why did you need to add “START /D” to the command that calls deadlinecommand? I’m on Windows 7 here and it works fine without it. Also, this script is meant to be cross-platform, so “START /D” won’t work on the Mac.

Cheers,

  • Ryan

Yes this is a non-cross platform quick ugly fix …

I have to do that because for some reasons, when calling directly : Pathtobin\deadlinecommand.exe, it somehow misses some dependencies from within the bin folder.

(same happens from within my batch script managing the render session)

Maybe that’d help if we had an interactive session so I can show you

Can you send us a screen shot of the error you get on your machine when submitting? In the meantime, we’ll see if there is a cross-platform solution we can use to set the startup directory when calling deadlinecommand.

Cheers,

  • Ryan

We believe we’ve found a cross-platform way of ensuring deadline is launched from the deadline bin folder. We just change the current directory to the deadline bin directory before executing deadlinecommand. See the code snippet below:

my $deadlinebin = "";
my $deadlinecommand = "deadlinecommand";
my $deadlinecommandbg = "deadlinecommandbg";

if( -e "/Users/Shared/Thinkbox/DEADLINE_PATH" )
{
	open my $file, '<', "/Users/Shared/Thinkbox/DEADLINE_PATH"; 
	$deadlinebin = <$file>; 
	close $file;
	
	$deadlinebin =~ s/^\s*(.*)\s*$/$1/;
	$deadlinecommand = "$deadlinebin/deadlinecommand";
	$deadlinecommandbg = "$deadlinebin/deadlinecommandbg";
}
else
{
	$deadlinebin = $ENV{"DEADLINE_PATH"};
	$deadlinecommand = "$deadlinebin/deadlinecommand";
	$deadlinecommandbg = "$deadlinebin/deadlinecommandbg";
}

# Change directory to avoid dependency issues.
chdir "$deadlinebin";

# Call DeadlineCommand to launch the monitor script file.
my $root = fix_path( `\"$deadlinecommand\" -getrepositoryroot` );
my $script = "$root/scripts/Submission/ModoSubmission.py";
lxout( "script: $script" );
if( -e $script )
{
	`\"$deadlinecommandbg\" -executescript "$script" "$sceneFile" "$frameRange"`;
}
else
{
	my $scripterrmsg = "The ModoSubmission.py script could not be found in the Deadline Repository. Please make sure that the Deadline Client has been installed on this machine,\nthat the Deadline Client bin folder is set in the DEADLINE_PATH environment variable, and that the Deadline Client has been configured to point to a valid Repository.";
	error_dialog( $scripterrmsg );
	return;
}

Well basically Launcher Crashes with Windows useless information window only allowing it to close when using :
C:\Users\jerome>“c:\Program Files\Thinkbox\Deadline6\bin\deadlinelauncher.exe”

When Using “c:\Program Files\Thinkbox\Deadline6\bin\deadlinelauncher.exe” -slave
Slave launches, deadlinelauncher process exists but does not show up in taskbar tray

When submitting from Modo, DOS command pops up, then closes almost instantly, then nothing happens and hand is given back to modo

I suspect some misconfiguration somewhere, or the need of having the launcher running as a process

What happens if you call “c:\Program Files\Thinkbox\Deadline6\bin\deadlinelauncher.exe” from the deadline6 bin directory?

Also, does the same problem happen if you run the other Deadline apps this way?

Finally, did you see my post above your most recent one about changing the directory in the perl script so that modo runs deadlinecommand from the bin directory?

Cheers,

  • Ryan

Missed the cross platform answer, will test that ASAP

As for launching deadlinelauncher.exe it works as expected when launched from deadline bin folder (that’s why I use START /D in the 1st place)

Privacy | Site terms | Cookie preferences