runAsClone(start_port=0, end_port=-1, debug=False, block=False, print_port=False, connection_timeout_seconds=-1)
This method opens a network port to receive connections from a host process. Once connected, the host process sends its hip file contents and any changes made in the host process. This process maintains its network state to match the host process, and sends back rendered images to the host.
Both graphical and non-graphical Houdini processes can act as clones. Using a graphical Houdini process as a clone may be useful for debugging, but generally clone processes will be non-graphical (hbatch
or hython
). Note that the synchronization if one way, from host to clones. Changes made in the clone process are not sent to the host process, and may cause issues with the synchronization of future changes from the host.
Generally (except for debugging) it is easiest to run a clone process in a blocking mode where user input and interaction with the clone process is not permitted until the host process disconnects. This is controlled with the block
parameter.
start_port
The lowest TCP/IP port number that can be opened for the host to establish a connection. The default value of 0
indicates that any available port can be used. In some renderfarm setups, only certain ports will allow a connection to be made from the host to the clone process. These restrictions will depend on the configuration of the firewall between the host and clone machines.
end_port
Highest TCP/IP port number that can be opened to receive the host connection. The default value of -1
allows any port number higher than the start_port
.
debug
Sets the clone process' networking debug mode. Setting this to True
will cause additional logging of networking events.
block
Controls whether user interation with this process should be blocked. This block lasts as long as a host process is connected to this clone (or the connection timeout expires without any host connection being established).
print_port
Set this to True
to have this process output its port number to the standard output stream. The output will be of the form HOUDINI_CLONE_PORT=12345
. The printing of this port is often necessary for the host process (which often launches the clone process) to know what port number it can use to connect to the clone process. The only other way to know the clone’s port number is by setting the start_port
and end_port
parameters to the same fixed value.
connection_timeout_seconds
Indicates how long this method should wait for a host connection to be established before giving up and closing the connection port. This setting can help prevent zombie processes on a render farm, but be sure to allocate enough time for the host process to establish communication with the clone.