vray.VRayServer

class vray.VRayServer

Bases: object

A server object for distributed rendering. It awaits connection from a client and serves render requests from it. Only one client at a time can be served.

Server objects have to be in separate processes. They can’t be created in the same process as VRayRenderer client objects.

VRayServer() constructor optional keyword arguments:

  • portNumber, int - Which port to accept connections on (leave at 0 for default - 20207 (DR1) or 20209 (DR2))

  • numThreads, int - Number of threads to use for rendering (leave at 0 for all available)

  • remoteScenePath, string - The folder in which the received vrscene-file will be written, default is the temp folder

  • pluginLibraryPath, string - Alternative path to folder containing V-Ray plugins

  • includePaths, string - Semicolon separated list of file system paths to the folders containing scene include files

  • noRenderLicensePreCheck, bool - Do not check if RenderNode license is available when creating the server (it’s always checked when rendering is started), default: false

  • changeCurrentDirectory, bool - Change the current folder to remoteScenePath, default: false.

  • keepSceneInMemory, bool - Do not write a temporary vrscene-file, keep the scene data in memory only, default: false.

  • overwriteLocalCacheSettings, bool - True to override any local cache settings on the render servers with the value from the client machine. Default: false.

  • runAsLiveLink, bool - True to use the underlying renderer as a dr/live-link interface. Default: false.

  • cachedAssetsLimitType, int - 0=no limit for assets cache; 1=hour limit; 2=gigabyte limit

  • cachedAssetsLimitValue, float - value in hours or GB when cachedAssetsLimitType is 1 or 2

  • dr2AsDispatcher, bool - (DR2 only) Whether the instance will act as a Dedicated Dispatcher.

  • dr2RunLocalRenderServer, bool - (DR2 only) (Dispatcher only) Whether the dispatcher should run a local render server.

  • dr2SecureConnection, bool - (DR2 only) Whether SSL/TSL should be enabled for connections from/to this dispatcher/server.

  • dr2DisableUdp, bool - (DR2 only) Whether UDP discovery should be disabled.

  • dr2ListenOnIpv4, bool - (DR2 only) Whether to listen on IPv4 local sockets.

  • dr2ListenOnIpv6, bool - (DR2 only) Whether to listen on IPv6 local sockets.

  • dr2PipelinedUpstream, bool - (DR2 only) Whether to use pipelining. Note pipelining will be disabled internally (even if requested), if a proxy is configured or is discovered between the client and a remote server.

  • dr2HttpProxy, string - (DR2 only) server:port connection parameter for http connections via proxy

  • dr2WorkerThreadsPerServer, int - (DR2 only) Number of worker threads per each server instance we start

  • dr2ConnectTimeout, int - (DR2 only) Initial connection timeout in seconds

  • dr2UpstreamChannels, int - (DR2 only) Number of upstream connections, which the client side will use, when pipelining is not enabled

Attributes

closed

Server already closed if true.

options

Returnsa copy of the current server options dictionary.

Methods

__init__(*args, **kwargs)

addHosts(self, hostlist)

NOTE: Available in DR2 only.

close(self)

Closes the server.

getActiveHosts(self)

NOTE: Available in DR2 only.

getAllHosts(self)

NOTE: Available in DR2 only.

getInactiveHosts(self)

NOTE: Available in DR2 only.

removeHosts(self, hostlist)

NOTE: Available in DR2 only.

resetHosts(self, hostlist)

NOTE: Available in DR2 only.

run(self)

Runs the server in the current thread.

setOnConnect(self, callback, float], None])

Sets a callback function to receive a notification when a renderer is connected to this server.

setOnDisconnect(self, callback, float], None])

Sets a callback function to receive a notification when a renderer is disconnected to this server.

setOnLogMessage(self, callback, int, …)

Sets a callback function to receive text messages from VRayServer.

setOnProgress(self, callback, int, int, …)

Sets a callback function to receive the progression of VRayServer processing.

setOnStart(self, callback, None])

Sets a callback function to receive a notification when rendering on this server starts.

start(self)

Starts the server in a separate thread.

stop(self)

Stops the server.

addHosts(self, hostlist: Sequence[str]) → int

NOTE: Available in DR2 only. Adds V-Ray servers to the current renderer.

Arguments:
  • hostlist, list/tuple of host names or ip:port strings

Return values:

  • -2 - Failed to resolve hostname

  • -1 - Internal DR2 Error

  • 0 - Hosts were added to the list, but failed to connect

  • 1 - Hosts were successfully added and connected if rendering was in progress

  • 2 - Hosts were successfully added to the list, but weren’t connected due to lack of work

Note: Connection is not established until rendering starts

close(self) → None

Closes the server. It can’t be used after this call.

getActiveHosts(self) → str | None

NOTE: Available in DR2 only. Returns all active V-Ray servers attached to the current dispatcher.

getAllHosts(self) → str | None

NOTE: Available in DR2 only. Returns all V-Ray servers attached to the current dispatcher.

getInactiveHosts(self) → str | None

NOTE: Available in DR2 only. Returns all inactive V-Ray servers attached to the current dispatcher.

removeHosts(self, hostlist: Sequence[str]) → bool

NOTE: Available in DR2 only. Removes V-Ray servers from the current renderer.

Arguments:
  • hostlist, list/tuple of host names or ip:port strings

resetHosts(self, hostlist: Sequence[str]) → bool

NOTE: Available in DR2 only. Resets the hosts list for distributed rendering.

If rendering is in process, hosts that are not on the new list are disconnected. The new list can be empty.

Arguments:
  • hostlist, list/tuple of host names or ip:port strings

Return values:

  • -2 - Failed to resolve hostname

  • -1 - Internal DR2 Error

  • 0 - Hosts were added to the list, but failed to connect

  • 1 - Hosts were successfully added and connected if rendering was in progress

  • 2 - Hosts were successfully added to the list, but weren’t connected due to lack of work

Note: Connection is not established until rendering starts

run(self) → None

Runs the server in the current thread. A blocking call.

setOnConnect(self, callback: Callable[[str, float], None]) → None

Sets a callback function to receive a notification when a renderer is connected to this server.

Callback arguments:
  • hostname, string - the host name (or IP address) that connected.

  • instant, float - Relative time of the event in seconds since V-Ray initialization

setOnDisconnect(self, callback: Callable[[str, float], None]) → None

Sets a callback function to receive a notification when a renderer is disconnected to this server.

Callback arguments:
  • hostname, string - the host name (or IP address) that disconnected.

  • instant, float - Relative time of the event in seconds since V-Ray initialization

setOnLogMessage(self, callback: Callable[[str, int, float], None], minLogLevel: int | None = None) → None

Sets a callback function to receive text messages from VRayServer.

Arguments:
  • callback - see below

  • minLogLevel, int - [optional] one of the vray.LOGLEVEL_* constants for the minimum level that will emit a callback.

Callback arguments:
  • message, string - the text from V-Ray

  • level, int - the severity of the message (error=0, warning=1, info=2, debug=3)

  • instant, float - Relative time of the event in seconds since V-Ray initialization

Level values (see also vray.LOGLEVEL_* constants):

  • 0=errors

  • 1=warnings

  • 2=normal info

  • 3=debug

setOnProgress(self, callback: Callable[[str, int, int, float], None]) → None

Sets a callback function to receive the progression of VRayServer processing.

Callback arguments:
  • message, string - description of the currently performed render task

  • progress, int - work units completed so far

  • total, int - total number of work units for the current task

  • instant, float - Relative time of the event in seconds since V-Ray initialization

setOnStart(self, callback: Callable[[float], None]) → None

Sets a callback function to receive a notification when rendering on this server starts.

Callback arguments:
  • instant, float - Relative time of the event in seconds since V-Ray initialization

start(self) → None

Starts the server in a separate thread. A non-blocking call.

stop(self) → None

Stops the server. It can be started again.

closed

Server already closed if true.

options

Returnsa copy of the current server options dictionary.