Streamlining Job Submission with Sanity Checks

Version: Deadline 7.2

Overview

All workflows are unique, and as such some of Deadline’s integrated submitters have been set up to allow users to add their own submission sanity checks. These checks can be used to enforce specific standards for submission settings, or display warning and reminder messages.

This post will take a look at some of the integrated submitters that can run sanity checks and will build up sample scripts to show what can be done with them. All features are available in Deadline 7.2 and later, except where indicated.

Note that when this post refers to <DeadlineRepository>, it is referring to your root Repository directory.

Supported Software

Sanity checks are supported in the following applications:

  • 3ds Max
  • After Effects
  • Cinema 4D
  • Fusion
  • Houdini (Deadline 8 only)
  • Maya
  • Modo
  • Nuke
  • Softimage

This post is going to focus on 3ds Max, Cinema 4D, Houdini and Maya. We will take a look at how sanity checks work in each of these applications and go over an example script showing each in action. Additional information for all of the supported applications can be found in the Application Plugins documentation.

3ds Max

In 3ds Max, sanity checks can be run when a job is about to be submitted, or they can be run manually. They allow the user to define their own functions that will run and detect issues. They can also create functions to automatically fix any issues that are detected.

For this example, I am going to create a script that will make sure the submitted jobs are forced to have a machine limit, and that the machine limit cannot be greater than 50. In order to do this, I am going to modify the file SubmitMaxToDeadline_SanityCheck_Private.ms located in <DeadlineRepository>\submission\3dsmax\Main.

We are going to start by modifying the struct SMTD_Private_SanityCheckFunctions. This struct defines the functions that are used to determine if a sanity check has passed, and as such we want to make a new function that will return true if the effect is already enabled.

struct SMTD_Private_SanityCheckFunctions
(
fn CheckMachineLimit =
(
SMTDSettings.limitEnabled and SMTDSettings.MachineLimit <= 50
)
)--end struct

The next thing we want to do is to create a function that will fix this issue. In order to fix it we will need to create a repair function in the struct SMTD_Private_RepairFunctions that will modify the settings of the SMTD window.

struct SMTD_Private_RepairFunctions
(
fn FixMachineLimit =
(
SMTDSettings.limitEnabled = true
setIniSetting SMTDPaths.InIFile "JobSettings""LimitEnabled" ( SMTDSettings.LimitEnabled as string)

SMTDSettings.machineLimit = 50
setIniSetting SMTDPaths.InIFile "JobSettings""MachineLimit" ( SMTDSettings.MachineLimit as string)

SMTD_SanityCheck_errorReportRollout.log_action "Fixed" (color 0 155 0) true "Machine Limit set to 50"
)
)--end struct

Finally we need to add the sanity check to the list of sanity checks that are being run. This can be done by modifying the array SMTD_Private_SanityChecksToPerform, which defines what sanity checks to run and what should happen if they fail. In our case it will display a message stating that it failed and it will run the repair function.

SMTD_Private_SanityChecksToPerform = #( --The list of sanity checks to run, whether or not they should be fixed, the message to be displayed and how it should be repaired if it can be.
#(SMTD_Private_SanityCheckFunctions.CheckMachineLimit, #fix, "FF:The current Machine Limit is either disabled or greater than 50!.", SMTD_Private_RepairFunctions.FixMachineLimit, true)
)--end checks array

After we have defined this, we can run the sanity checks which will show us that the machine limit failed. We can then right click this if we want to run our repair function.

See the 3ds Max Sanity Check documentation for more information.

Cinema 4D

In Cinema 4D, sanity checks are automatically run when you launch the submitter, and can be used to set default submission settings, display messages, and run any other Python code you wish to run. Sanity checks can be added by creating a CustomSanityChecks.py file alongside the main SubmitC4DToDeadline.py submission script in <DeadlineRepository>\submission\Cinema4D\Main. Simply create a function in this file called RunSanityCheck, and then add your sanity check code to it.

In this example, we are going to create a sanity check that will disable the Job name text box so users cannot change it, and will fail to open if the scene is not set up to save the main output image. In order to do this, we need to create the script mentioned above, and ensure that it contains the function RunSanityCheck that accepts the submitter’s dialog as its parameter (giving you full control to modify the window).

import c4d
from c4d import gui
from c4d import documents

def RunSanityCheck( dialog ):
#Disable the Job Name Box
dialog.Enable( dialog.NameBoxID, False )

#Find out if the scene is set to save the output Image
scene = documents.GetActiveDocument()
renderData = scene.GetActiveRenderData().GetData()
saveOutput = renderData.GetBool( c4d.RDATA_SAVEIMAGE )

#Return False if the scene is not set up with the correct settings
if not saveOutput:
gui.MessageDialog( "The scene is not set up to save the main output image!" )
return False

return True

If I try to run the submitter for a scene that isn’t saving the main output image, I’ll see the following message:

See the Cinema 4D Sanity Check documentation for more information.

Houdini (Deadline 8 only)

In Houdini, sanity checks are automatically run when you launch the submitter, and can be used to set default submission settings, modify the submitter, and set extra info parameters for submitted jobs. Sanity checks can be added by creating a CustomSanityChecks.py file alongside the main SubmitHoudiniToDeadline.py submission script in <DeadlineRepository>\submission\Houdini\Main. Simply create a function in this file called RunSanityCheck, and then add your sanity check code to it.

In this example, we are going to create a sanity check that will disable the Job name text box so users cannot change it. We are also going to add an extra info key value that also contains the job name, and we are going to force the job to be wrapped in a batch. This sanity check will also prevent the submitter from launching if using a version of Houdini earlier than version 15. In order to do this, we need to create the script mentioned above, and ensure it contains the function RunSanityCheck that accepts the submitter’s dialog and an object containing additional information as its parameters (giving you full control to modify the window).

import hou

def RunSanityCheck( dialog, additionalInfo ):
#Disable the Job Name box
dialog.enableValue( "jobname.val", False )

#Set an ExtraInfoKeyValue that will be submitted as part of the job
additionalInfo.ExtraInfoKeyValues["JobName"] = dialog.value( "jobname.val" )

#Make sure the job is part of a Batch
additionalInfo.ForceBatch = True

#Don't open the submitter if the the version number of Houdini is less then 15.
if hou.applicationVersion()[0] < 15:
hou.ui.displayMessage( "Jobs can only be submitted from Houdini 15 and later.", title="Submit Houdini To Deadline" )
return False

return True

If I try to run the submitter from Houdini 14, I’ll see the following message:

When Deadline 8 is released, you can refer to the Houdini Sanity Check documentation for more information.

Maya

In Maya, sanity checks can be set up to run when you launch the submitter, as well as when you go to submit the job.

In this example, we are going to create 2 sanity check scripts:

  • One that will set the initial priority based on the renderer being used when submitter is opened.
  • One that will make it so the job cannot be submitted without a group being selected.

The first script that we need to create is called CustomSanityChecks.mel, and should be created in <DeadlineRepository>\submission\Maya\Main. This file is run when the submitter is first opened.

//Make sure that the attribute we want to set exists in the scene
AddLongAttribute( "deadlineJobPriority" );

// For this example we want all vray jobs to have a higher priority then Mental Ray jobs and we want all other jobs to be a lower priority
if( GetCurrentRenderer() == "mentalRay" )
        setAttr defaultRenderGlobals.deadlineJobPriority 60;
else if( GetCurrentRenderer() == "vray" )
        setAttr defaultRenderGlobals.deadlineJobPriority 80;
else
        setAttr defaultRenderGlobals.deadlineJobPriority 40;

The second script that we are going to create is called CustomPostSanityChecks.mel, and should be created in <DeadlineRepository>\submission\Maya\Main. This script must define a proc call CustomPostSanityCheck, which returns whether or not the job can be submitted.

global proc CustomPostSanityCheck()
{
        // pull the name of the group from the submitter
        string $groupName = `optionMenuGrp -q -value frw_Group`;
        // Don't allow jobs to be submitted to the none group
        if( $groupName == "none" )
                return 0;
        return 1;
}

See the Maya Sanity Check documentation for more information.

Wrapup

These are just a few examples of what can be done to customize your workflow using sanity checks. With a full understanding of sanity checks, you will be able to guarantee that your scene is set up properly so that they will render correctly the first time.