RenderFarmΒΆ
class RenderFarm
An empty renderfarm interface. To override in plugin.
RenderFarm is the interface which must be inherited and overloaded in order to connect Guerilla to a render manager system and its render farm.
See the submit method for detailed information on implementing a RenderFarm interface
Hierarchy
class RenderFarm < class Node
Members
| gettemplate | ( ) | Return a property template table to be displayed in the property sheet |
| initrender | (
|
Returns true if the interface initialization succeeded for a render, to be overriden. |
| needfiles | ( ) | Returns true if the interface needs the jobs file dependencies (to sync them with a server for instance). In this case the file list will be passed to the submit method in options['Files']. |
| submit | (
|
Submit a list of jobs with options to the renderfarm |
| declare | (
|
Declare a new render farm interface. |
| get | (
|
Get a RenderFarm interface by its name |
| getlocal | ( ) | Get the batch or local RenderFarm interface |
| getmain | ( ) | Get the current active RenderFarm interface |
Inherited from class Node
string | Name | RW | The node name |
| belongstoreference | (
|
Tells if the node belongs to the reference, or a sub reference |
| delete | ( ) | Delete a node |
| eval | (
|
Called by the framework when plug (a node's plug) must be evaluated |
| findchild | (
|
Find a child node or plug using a path |
| findparent | (
|
Find the first parent Node of this Node of a specific class |
| getchild | (
|
Get a child node by its name |
| getname | ( ) | Get the Node name in its parent |
| getparent | ( ) | Get the parent Node of this Node |
| getpath | ( ) | Returns the node path as a string that can be reused with findchild |
| getreference | ( ) | Returns the reference node it is connected to |
| getreferences | (
[
|
Returns the references in the document sorted depth first. |
| getstringcopy | ( ) | Return a copy of the node and its content as a string to be pasted |
| gettopreference | ( ) | Returns the top reference node it is connected to |
| iseditable | ( ) | Indicates if the node can be edited by the user in the UI |
| ismoveable | ( ) | Tells if the node can be moved |
| isparent | (
|
Tells if this node is parent of the potential child |
| isreference | ( ) | Tells if a node comes from a reference project |
| isselected | ( ) | Tell if the node is selected |
| loadfile | (
|
load a file content in this node. Possible options are: overrideclass to enforce a specific class for the root node. |
| loadtemplate | (
|
load a template file |
| move | (
|
Move a node to a new parent |
| onpathchanged | ( ) | Called by the framework when the name of this node or of one of its parent is modified |
| pastestringcopy | (
|
Paste a string copy into this node |
| referencefile | (
|
reference a file content in this node. |
| rename | (
|
Rename a node |
| savefile | (
|
load a node to a file |
| seteditable | (
|
Change the editable state of the node |
| setflags | ( ) | Set the node flags |
Documentation
Return a property template table to be displayed in the property sheet
table
Returns true if the interface initialization succeeded for a render, to be overriden.
opts The options to be used in submit
Returns true if the interface needs the jobs file dependencies (to sync them with a server for instance). In this case the file list will be passed to the submit method in options['Files'].
Submit a list of jobs with options to the renderfarm
In Guerilla 1.x, the plug-in crafted its job like that :
guerilla.."/lua '"..job:getscriptfile (frame).."'"
In Guerilla 2.x, the plug-in crafts its job like that :
fs.expand (job:getcommandline (frame))
This method is called by Guerilla when the user renders frames on the render farm.
The first argument is a list of jobs to execute in order. A job can be either a preprocess (such as baking a shadowmap once for a sequence of frames), a frame process (rendering frames) or a postprocess (building a movie of final frames.)
Submitted jobs can dependent on one another. It is the minimum requirement for a job scheduler to implement dependencies. For instance, a frame job may be dependent on a shadowmap baking, and eventually the final movie job is dependent on the rendering of the frame job.
A job is a simple Lua task containing the following data:
- number JobId: a unique integer id
- string Type: "frame", "pre" or "post"
- boolean Array: the job is an array of frames
- table Dependencies: the list of job ids this job is dependent on
- string Script: the template path of the Lua job script to execute at each frame
- string Name: the template name of the job
Additionally, jobs contain the following methods:
- string getscriptname (number frame): get the actual name of the job for a given frame
- string getcommandline (number frame): returns the job command line in a string, like
'"$(GUERILLA)/lua" "job.lua" "--frame=1"'
. Every command line arguments are quoted. Some arguments may contain environment variables like $(GUERILLA). Those variables must be expanded before to run the command. This command line must be executed in the options.JobsDirectory directory. - table getcommandargs (number frame): returns the job command line arguments in a table, like
{"$(GUERILLA)/lua", "job.lua", "--frame=1"}
. The first argument is the path of the application to run. Each entry of the table in an unquoted command line argument. Some arguments may contain environment variables like $(GUERILLA). Those variables must be expanded before to run the command. This command line must be executed in the options.JobsDirectory directory
The second argument is a table of options. Options are set either by Guerilla or by the caller of the render function. Usual options are:
- string Name: a human readable name for the jobs to submit, default to the project name
- string FrameRange: the list of frames to render, see rangetonumbers function for details on the format of the string
- string ProjectDirectory: the directory of the current project, default to "$(SCENE_PATH)"
- string JobsDirectory: the directory where job scripts are written, default to "$(JOBS)"
- string RibsDirectory: the directory where rib files are written, default to "$(RIBS)"
A pseudocode RenderFarm implementation looks like:
-- Subclass RenderFarm
class ("MyFarm", "RenderFarm")
-- Construct MyFarm
function MyFarm:construct ()
LocalPlug ("MyFarmSettings", self, 0, types.string, "")
LocalPlug ("MyFarmOtherSettings", self, 0, types.int{min=10,max=20}, 15)
end
-- Generate the property template for MyFarm
function MyFarm:gettemplate ()
return {"MyFarm",
{
{ "Settings", self.MyFarmSettings },
{ "Other Settings", self.MyFarmOtherSettings },
}
}
end
-- Submit jobs to MyFarm
function MyFarm:submit (jobs, options)
-- Submit jobs to MyFarm
local frames = rangetonumbers (options.FrameRange)
local guerilla = "/usr/local/guerilla"
-- A simple way to submit jobs is to submit them in order, and make sure
-- the next job waits for the previous to finish
for k, job in ipairs (jobs) do
print ("Submit job "..job.Name)
if job.Array then
-- execute all frames on this job
-- TODO: replace this with your own scheduler submission command!
for k, frame in ipairs (frames) do
lfs.chdir (fs.expand (options.JobsDirectory))
os.execute ("echo running "..job:getscriptname (frame))
os.execute (fs.expand (job:getcommandline (frame)))
end
else
-- execute this single job
-- TODO: replace this with your own scheduler submission command!
lfs.chdir (fs.expand (options.JobsDirectory))
os.execute ("echo running "..job:getscriptname (1))
os.execute (fs.expand (job:getcommandline (1)))
end
end
end
jobs The list of jobs to submitoptions The submission options
success Return true if submission is successful
Declare a new render farm interface.
interface An instance of the RenderFarm derived class.
Get a RenderFarm interface by its name
name The RenderFarm class name
result The RenderFarm instance
Get the batch or local RenderFarm interface
Get the current active RenderFarm interface
result The current RenderFarm instance