AWS Thinkbox Discussion Forums

Frames per task

I have a job running 38 frames. by changing chunk size to 10 i am able to run 4 tasks instead of running multiple jobs. In task render log, their is a line which says, "Plugin rendering frame(s) : 1001 - 1010 " … this shows how many frames for current task

To make it simple,
In Job Properties → Nuke Settings → Script Filename , i am passing a script. To this script, I want to pass "plugin rendering frames " . How does one do that ?

What are you trying to do with that info?

I’m not familiar with the Nuke plugin, would that script be ran by nuke, by deadline or a seperate environment. How to best get that info would be different depending on that.

After submitting a job, then for each task this script is called. I have further found that

connect.Tasks.GetJobTask(job_id, task_id)

will give me frame range in a dictionary ( along with other data ). Good. Now the question is, while the script is running for each task, how does one know the task_id that this script is running for. IOW, i need current task id ?

In a plugin, use self.GetCurrentTaskId()
https://docs.thinkboxsoftware.com/products/deadline/10.1/2_Scripting%20Reference/class_deadline_1_1_plugins_1_1_deadline_plugin.html#a9b5d44eab5aa0feb0e7f32214dbb1cc7

This is the batch number, so if you have frames per task, process the entire range of batch elements for this task.

1 Like

I’ve had a look at the nuke plugin (still unfamiliar with nuke though. Is this a think that you are going to do regulary? If yes I think the most robust way of getting data from Deadline into this script is doing a modification to the nuke plugin.

The Plugin does take your ScriptFilename to compile and execute the script in the monitored managed process

self.WritePython( "with open(\"{}\") as f: exec(compile(f.read(), \"{}\", 'exec'), globals(), locals()))".format(scriptFileName, scriptFileName) )

You should be able to replace that line with something like this to have a variable “deadlineTaskId” availabe in you script when it runs from the nuke plugin.

# Open and read the script
f = open(scriptFileName, 'r')
scriptContent = f.read()
f.close

# Add deadlineTaskId variable to the script
addTaskIdVar = "deadlineTaskId = " + self.getCurrentTaskId()
scriptWithVar = addTaskIdVar + '\n' + scriptContent

self.WritePython( "with open(\"{}\") as f: exec(compile(\"{}\", 'myscript', 'exec'), globals(), locals()))".format(scriptFileName, scriptWithVar) )

To get rid of API calls in your script you could also pass self.getCurrentTask().TaskFrameString directly this way.

Disclaimer: I didn’t test this nor did I check for naming conflicts. I don’t think injecting variables this way is particulary elegant but it’s the first I could come up with not having used compile() ever before.

Privacy | Site terms | Cookie preferences