Submit Dependent Tiles Render

Ok, very new to Maxscript, and very new to Deadline, so be gentle.

So far, I have a script which sends a job which precalcs Irradiance and Lightcache maps using VRay, but how do it then submit a dependent tiles job?

I have currently got so far…

renderSceneDialog.close() rendSaveFile = true rendOutputFilename = (outputfile) -- render vr.options_dontRenderImage = false -- prepass irrmap load vr.adv_irradmap_mode = 2 vr.adv_irradmap_loadFileName = irrfile --prepass lc load vr.lightcache_mode = 2 vr.lightcache_loadFileName = lcfile --render send fileIn remoteScript SMTDFunctions.loadSettings() local TempMaxFile = maxfilepath + maxfilename SMTDSettings.SubmitSceneMode = #reposave SMTDSettings.JobName = maxFileName+" / FINAL / "+"[VRAY_ALLINONE]" SMTDSettings.TilesRendering = true SMTDSettings.TilesInX = 4 SMTDSettings.TilesInY = 4 SMTDSettings.TilesPadding = 20 SMTDSettings.SingleTileJob = true SMTDSettings.SingleTileJobDependent = true retCode = SMTDFunctions.spawnTileJobs forceMaxFile:TempMaxFile

anyone?

If I understand you correctly, you are asking how to do the dependency part (since the rest looks pretty good to me).

Assuming that your code for submitting the lighting calculations job came before the code your posted, you would need to insert the following between the two parts of the script:

--(YOUR LIGHTING JOB SUBMISSION CODE GOES HERE)

--Get the message from the previous submission:
renderMsg = SMTDFunctions.getRenderMessage()
--Extract the JobID of the first submission from that message:
SMTDFunctions.getJobIDFromMessage renderMsg
--Assuming the previous submission was successful, you can find it here:
if SMTDSettings.DeadlineSubmissionLastJobID != "failed" do
(
--get all jobs from Deadline Repository:
result = SMTDFunctions.CollectJobs()
--if the call was successful, the property SMTDSettings.JobsArray would contain the jobs
if result == #success do 
(
--collect an array with the indices of jobs matching your previous submission:
depJobs = for i = 1 to SMTDSettings.JobsArray.count where SMTDSettings.JobsArray[i][2] == SMTDSettings.DeadlineSubmissionLastJobID collect i
--assign the result as the bitarray of enabled dependency IDs
SMTDSettings.DependencyJobItems = depJobs as bitarray
)
)
--After the above code, if you have 
SMTDSettings.SubmitAsDependent = true
--and you call any functions that produce a JobInfoFile (like you do with the tile submission),
--the file entry "JobDependencies" will be set to the ID of the previously submitted job.

--(YOUR TILE SUBMISSION CODE GOES HERE)

Try this and see if it works for you.

Thanks Bobo, but unfortunately that doesn’t seem to have solved it. The jobs get submitted, but there is no dependency between them.

Happy to send the full code to anyone who would like to help me debug…

M

bobo AT thinkboxsoftware DOT com

Thanks Bobo, sent.

any joy Bobo?

anything?

I am sorry for the delay, I am looking into it right now…

Ok, found the problem(s).

Main problem was on line 106 - you were calling

SMTDFunctions.waitForCommandToComplete ( " -ResumeJob "+ SMTDSettings.DeadlineSubmissionLastJobID ) SMTDSettings.TimeoutCollectData

for some reason. The trouble is that every time you call waitForCommandToComplete(), the “render message” file is overwritten. So when you tried to submit the dependent Render job with the second button, it did not find the message from the first submission, but the message from the -ResumeJob attempt!

The line

irr_dep_job = SMTDSettings.DeadlineSubmissionLastJobID

was a great idea since it would have captured the correct ID at the right time and passed it over to the render job, but you never used it in the Render submission.

I assume you were just too afraid to touch my code :slight_smile: Don’t be, it did not include any knowledge of what else was going on in your code.
So just modify it like this:

--Get the message from the previous submission: --renderMsg = SMTDFunctions.getRenderMessage() --BOBO: WE DON'T NEED THIS ANYMORE! --Extract the JobID of the first submission from that message: --SMTDFunctions.getJobIDFromMessage renderMsg --BOBO: WE DON'T NEED THIS ANYMORE! --Assuming the previous submission was successful, you can find it here: if irr_dep_job != "failed" do --BOBO: WE USE THE JOB ID VARIABLE FROM THE PREVIOUS SUBMISSION! ( --get all jobs from Deadline Repository: result = SMTDFunctions.CollectJobs() --if the call was successful, the property SMTDSettings.JobsArray would contain the jobs if result == #success do ( --collect an array with the indices of jobs matching your previous submission: depJobs = for i = 1 to SMTDSettings.JobsArray.count where SMTDSettings.JobsArray[i][2] == irr_dep_job collect i --BOBO: USE THE JOB ID VARIABLE --assign the result as the bitarray of enabled dependency IDs SMTDSettings.DependencyJobItems = depJobs as bitarray ) )

When I make these modifications, I get 3 jobs - the Caching job in green, the Render job as dependency in orange, and a tile assembly job dependent on the render job in orange.

Hope this helps!

legend! very happy with that, thanks Bobo.

honestly never touched maxscript at all, so surprised i got this far without breaking something, and was definitely afriad to hack into your code too much.

i owe you a beer!

m