Idiot scripting questions

I’m trying to write a post-task slave script, and I need to get the actual filename of the frame the slave has just finished rendering/writing. After trying seventeen different hacks to try and get it (all of which have failed), I’m wondering if there’s a (fairly) simple way of doing this. The problem I keep running into is the lack of a reliable way to get the frame number of the frame the slave has rendered (not the task ID, the actual frame number). My thought was to use SlaveUtils.GetCurrentSlaveInfoValue(“CurrentTaskNames”), after looking at the .slaveInfo file, but that value isn’t being re-read/refreshed per-task, so it always returns the same number.

Also, where on earth does ScriptUtils.LogText() actually log things to? Because it sure isn’t the Job log…

In related news, is there a comprehensive set of documentation for the Deadline.Scripting module? The online docs seem to barely scratch the surface, and do so in a fairly scattered fashion.

Thanks a lot

You can use the global functions GetStartFrame() and GetEndFrame() to the the frame range for the current task. Both of these functions return integers, so you can use a for loop to cycle through the frame range. There is a good example of this in our documentation for Job Scripts:
software.primefocusworld.com/sof … cripts.php

The Job Scripts page also links to the global plugin functions that are available (including GetStartFrame and GetEndFrame):
software.primefocusworld.com/sof … _Reference

The Deadline.Scripting module gives you access to many utility functions, which are covered here (section 1.3):
software.primefocusworld.com/sof … erview.php

This includes the ScriptUtils.LogText() function: Writes to the log of the application calling the script (either the Monitor or the Slave).

If you want to write to the job log, use the LogInfo or LogWarning global functions defined here:
software.primefocusworld.com/sof … l_Funtions

I’ll admit that the example in the Job Scripts documentation indicates that ScriptUtils.LogText() logs to the render log. This is incorrect and we need to change this. Sorry for the confusion.

Cheers,

  • Ryan

Thanks for the info on the logging functions Ryan. However, I’m still not seeing a way to do quite what I’m after with the frame numbers. Say a slave is rendering frame 50 of a 3ds max job, but that frame is actually task 0 of the Deadline job. Is there a way I can query the actual frame number (50) that the slave has just finished rendering (at the slave level, through a post-task script)? Or the actual output filename it has just written (not the global job output name like “myRender_r00_v01_####.exr”)?

I feel like this info should still be present somewhere during the post-task phase, since the task hasn’t been released yet… but maybe a lookup of the current task ID in the frame range is the only way to do this. If that’s the case, I’m still unsure whether or not that value will update correctly on a per-frame basis (since the “taskNames” value doesn’t).

I must be missing something, because the example I pointed you to should cover everything you’re looking for:
software.primefocusworld.com/sof … cripts.php

If the slave is rendering task 0, and that task represents frame 50, then both GetStartFrame() and GetEndFrame() will return 50. If that task represents the range 50-54, then GetStartFrame() will return 50, and GetEndFrame() will return 54.

Also, that example shows how to walk through the frames for the task, and swap out the padding in the global output name with the appropriate frame number. Just remember to use LogInfo() to log information that you want to appear in the job log, instead of ScriptUtils.LogText().

Oh, I see now. Thanks for clearing that up… for some reason I was thinking that GetStartFrame() and GetEndFrame() were still referencing the global job frame range… Makes much more sense now, and this should be just what I need.