PDA

View Full Version : Prerender callback + netrendering (...again)


legie
10-08-2008, 06:12 PM
Hi everyone,
I know this problem has been discussed numerous times here but after reading through a lot of posts I am still not sure how to come to the best solution for my task:

I want to read the rendersettings (filename, output path, render elements, etc.) for a job that is sent to the renderfarm (backburner) via the regular netrender submitter dialog.

How do I do that as clean and elegant as possible? As far as I know there is no callback like "prerender" that works once for a netrender job.

Any suggestions? Where to start?

Thanks!

ZeBoxx2
10-08-2008, 06:55 PM
hmmm clean and elegant might be difficult...

Apparently there's no special little dialog that pops up when you're submitting a network render job; so detecting that using dialogMonitorOps appears to be out. D'oh.

You could write your own netrender submission dialog; then you can certainly record whatever you want. That would have the down side of writing your own dialog.

You could still use #preRender and write out the data to a shared location, and only allow one node to actually write to it (i.e. the rest check if the data is already written out - if it is, then don't write it out again). That has the down side of some fairly unclean network I/O.

You could use #preRender and get the firstFrame value out of the notificationParam, and check if that matches the first frame in the scene's frame range setup (as set in the render scene dialog, see "Render Scene Dialog > Common Parameters > Time Output Group"), then write that out. That has a down side in that the first computer to render may not be the computer that hits that first frame - that frame may not be hit until later, if you're unfortunate.

hmmm...

Kramsurfer
10-10-2008, 08:38 AM
All that information is in the XML document found on the server that is hosting the BB manager. We have open shares to the "network" folder on our BB servers. A script of any flavor can go read that info via xml parsing....
To change the xml and have it effect the job, you need to archive the job, change it, and restart it.. I've a python example of that in the python n MSX sticky thread on this forum.
Changes made in the Monitor app will also NOT be reflected in the XML docs. So if you restart the BB manager, all the jobs go back to their settings at time of submittal...

legie
10-13-2008, 08:58 AM
Thanks for the responses and sorry for my delayed reply; I was out of office for two days.

Kramsurfer, am I right to understand that BB creates something like a log xml file for every render job and I could read that out and process the information further via xml parsing? I don't even need to change a job or something like that, I only need to create my own little
'render histroy' (including version, outputpath, render elements) file for each job.

I think I will try a #prerender script solution for now, like zeboxx mentioned it, but I definately will start to look into xml/python/mxs handling as soon as possible.

Thanx!

legie
10-13-2008, 10:00 AM
hi,
I just realized that I am not quite sure about this approach:

You could use #preRender and get the firstFrame value out of the notificationParam, and check if that matches the first frame in the scene's frame range setup (as set in the render scene dialog, see "Render Scene Dialog > Common Parameters > Time Output Group"), then write that out. That has a down side in that the first computer to render may not be the computer that hits that first frame - that frame may not be hit until later, if you're unfortunate.

Do you mean that I regulate to execute my script exactly once by checking whether I am rendering the first frame and only then I run the callback script? I would get the information which frame is rendered out of the notificationParam?
I think that might work, as it is not a problem that I don't know when the output happens. As long as it is there once the rendering is done.

ZeBoxx2
10-13-2008, 12:34 PM
Do you mean that I regulate to execute my script exactly once by checking whether I am rendering the first frame and only then I run the callback script? I would get the information which frame is rendered out of the notificationParam?
Well, that's what I thought - but of course it actually fails; a network node will tell you that firstFrame is the first frame in the entire range, regardless of whether it's the first frame in the range of frames it's getting served.

Not a big problem, though - in fact: it's useful, as that means we don't have to bother with the render scene dialog settings.

Two callbacks, then... one for #preRender that initializes a variable to (callbacks.notificationParam())[23]:
TimeValue firstFrame;

This data member is available in release 2.0 and later only.

This is the first frame that will be rendered. This lets Open() know the first frame that will be rendered, so it will not have to evaluate at frame 0 when building.

And another in #preRenderFrame that gets the current frame being rendered (can just use currentTime, or use (callbacks.notificationParam())[13])

Then just compare the two and only write out the data if the two match.

*crosses fingers*

legie
10-13-2008, 12:45 PM
I see...I will try that!
Unfortunately I just got another task handed in that needs to be done first...as usual;-)


I will let you know how it goes once I have some results.

ZeBoxx2
10-13-2008, 01:00 PM
beat me to editing my post, so here's a reply instead...

Just a very short piece of sample code. Note that you must add the callbacks as persistent to make sure the callbacks are run in the network render as well. This sample code will write out to a file called 'datafile.txt' on the Z drive (a mapped network drive here) that contains the first frame in the sequence, and which computer rendered it.

You might want to add a check for IsNetServer() so that it won't run outside of network renders :curious:



callbacks.removeScripts id:#test
callbacks.addScript #preRender "global firstFrame = (callbacks.notificationParam())[23]" id:#test persistent:true
callbacks.addScript #preRenderFrame "if (currentTime == firstFrame) then ( f = createFile \"Z:\\\\datafile.txt\"; format \"first frame (%) rendered by %\\r\\n\" currentTime sysinfo.computername to:f; close f )" id:#test persistent:true

CGTalk Moderation
10-13-2008, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.