AWS Thinkbox Discussion Forums

Setting dependencies via Maxscript

Hi,

I am implementing Deadline submission for a script that sends batch renders of animated cameras. The script sends first all the GI prepasses for each camera in the scene and then all the main passes.

I know the suggested method by Bobo is to send pairs of prepass & main pass creating for the main pass a dependency on the last submitted job like this:

SMTDSettings.DependOnPreviousJobMode = #last
SMTDSettings.DependencyJobItems = #{1}

I can not use this method as I still want to send first all the GI prepasses and then the Main passes.

Instead, I can write a submission function that sets a dependency to a specific job sent in the current session by passing the job ID of the prepass. Here is the pertinent fragment of code:


--Note: svars is an instance of a struct containing submission variables.

if svars.isPrepass then
(
	lastJob = #(jobName, SMTDSettings.DeadlineSubmissionLastJobID, "", "", "", "", "", "")
	append SMTDSettings.PreviousJobsArray lastJob
)

if svars.isDependentJob then
(		
	SMTDSettings.SubmitAsDependent = true
	
	dependsOnJob = 0
	dependsOnJobID = undefined
	
	for previousJobIndex = 1 to SMTDSettings.PreviousJobsArray.count do
	(		
		--The variable cam contains a camera.
		--The name of the camera is also used to create the name of the GI prepases,
		--so I will look for that string in the SMTDSettings.PreviousJobsArray,
		if (findstring (SMTDSettings.PreviousJobsArray [previousJobIndex] [1]) svars.cam.name) != undefined do

		(
			dependsOnJob = previousJobIndex
			dependsOnJobID = SMTDSettings.PreviousJobsArray [previousJobIndex] [2]
		)
	)
	
	SMTDSettings.DependOnPreviousJob = True
	SMTDSettings.DependOnPreviousJobID = dependsOnJobID 
)

else
(
	SMTDSettings.SubmitAsDependent = false
)

For some reason this doesn’t work. The jobs are all submitted correctly, but dependencies are not set. All the prepass jobs are correctly stored inside the SMTDSettings.PreviousJobsArray and their ID’s are correct.

What am I missing here?

Thanks,
Jordi

The properties

SMTDSettings.DependOnPreviousJob = True SMTDSettings.DependOnPreviousJobID = dependsOnJobID
are not used anymore - I checked the code, and they were left for safety to avoid crashes if some script still tries to access them, but they have not been in use for a veeeery looong time.

You still need to use the approach you mentioned in the beginning. You can populate the list of previous jobs with as many jobs as you want. Then you just set the mode to #previous, perform the search for the ones you want as you did in your code snippet, and set the SMTDSettings.DependencyJobItems bitarray to the indices of the jobs you want to depend on. The rest is magic.

Something like this:

SMTDSettings.DependencyJobItems = #{} --reset all bits to false for i= 1 to SMTDSettings.PreviousJobsArray.count do --loop through all records ( if (matchPattern SMTDSettings.PreviousJobsArray[i][1] pattern:("*"+svars.cam.name+"*") do --if the camera name matches SMTDSettings.DependencyJobItems[i]=true --set the bit to mark that job as dependency )

Thanks Bobo,

That worked fine. I didn’t know that some SMDT.Settings variables where not in use. Are there any resources explaining what the variables and functions available through the SMDT do?

At the moment the only solution I found to scrip for Deadline is to read the extremely long code of the SMDT and online forums, which all seem to be outdated on the dependencies subject.

Thanks again,
Jordi

The SMTD source code is currently the main source of information.

The Dependencies come up a lot here on this forum, I am sure there are a few very up to date posts one could find.
However, I am considering writing more about some of these topics in the near future. At the moment I am rewriting the SMTD docs for the next Deadline release, so I will either add a whole chapter on scripting SMTD, or keep on adding tutorials or blog entries to the Deadline website…

Privacy | Site terms | Cookie preferences