Interface: NetRender

Methods

<Interface>GetManager()

In order to access network rendering through the scripter, you need to create a manager instance. The syntax is the following:

netrender.getmanager()

Working with the Manager

The following methods can be used to query and or control the manager.

<netManager>.setCallback #progress | #message | #update | #managerdown | #queuecontrol | #querycontrol <somefunction>

Used to listen to the manager for certain event types that occur during a network render. For each event type, you can call a single function that you define. Each of the 6 callback types is one type of event, and you can install a callback for any of these event or none.

You must define the function to take a different number of arguements depending on the event type.

Requires 2 arguments, they can be:

#progress myprogess

Called anytime a download/upload is underway, including anytime you fetch information about jobs or servers.

Requires a function defined with 2 integer parameters, 'Total' and 'Current'. Total is the total amount to transfer, and Current is the amount tranferred so far.

Example:

fn myprogress total current = -- NOTE: two integer parameters

format "Progress: completed % out of %\n" current total

m.setcallback #progress myprogress -- sets the #progress callback to use myprogress()

#message mymessage

Called when the manager has a text message for the user. Requires a function defined with 1 string parameter which is the message text.

Example:

fn myNetMessage msg = -- NOTE: one string parameter

format "Message: %\n" msg

m.setcallback #message mymessage -- sets the #message callback to use mymessage()

#update myupdate

Called when something has changed, like a job started or finished. Let's you know when you need to make GetUpdate calls, or other refreshing. Requires a function defined with no parameters.

Example:

fn myUpdate =

job.GetUpdate() --example of what you might do

m.setcallback #update myupdate -- sets the #update callback to use myupdate()

#managerdown mymanagerdown

Called when the manager shuts down. Requires a function defined with no parameters.

Example:

fn myManagerDown =

format "Manager is dead\n"

m.setcallback mymanagerdown -- sets the #managerdown callback to use mymanagerdown()

#queuecontrol myqueuecontrol

Called whenever queue control changes. Requires a function defined with no parameters.

Example:

fn myQueueControl =

format "Queue control has changed\n"

m.setcallback #QueueControl myQueueControl --install the "QueueControl" callback

#querycontrol myquerycontrol

Called when you have Queue Control, and another computer wants it, either via the QueueManager, or with the script function <netManager>.QueryControl(). If you want to keep control, set the value <netManager>.WantControl to true, otherwise set it to false. The function must take one arguement, which is the name of the machine requesting control. See the function <netManager>.QueueControl() for more information.

Example:

fn myQueryControl clientName = ( --NOTE: one string parameter

format "The computer % wants queue control" clientName

m.wantControl = true -- use this to keep queue control

m.wantControl = false -- use this to release queue control

)

m.setcallback #QueryControl myQueryControl --install the "QueryControl" callback

<netManager>.GetCallback <#progress | #message | #update | #managerdown | #queuecontrol | #querycontrol>

Returns the name of the function used for that particular callback. Returns an empty array if no callback is assigned. Requires 1 argument, can be:

#progress : Called anytime a download/upload is underway, including anytime you fetch information about jobs or servers

#message : Called when the manager has a text message for the user

#update : Called when something has changed, like a job started or finished. Let's you know when you need to make GetUpdate calls, or other refreshing

#managerdown : Called when the manager dies

#queuecontrol : Called whenever queue control changes

#querycontrol : Called when you have Queue Control, and another computer wants it

<netManager>.connect #manual <manager name>|<manager IP address> [port:<integer>]

or

<netManager>.connect #automatic <subnet mask> [port:<integer>]

Establishes a connection to the manager, allowing access to job states, server states, editing job settings, etcà.It takes 2 arguments and a 3rd optional argument. You can either connect to a manager manually by specifying the manager name or ip address of the manager as a string, or automatically by specifying the subnet mask and optional port number, eg:

m.connect #manual "manager" -- connects to manager of name "manager"

or

m.connect #manual "192.168.0.1" -- connects to manager of IP 192.168.0.1

or

m.connect #automatic "255.255.255.0" port:1234 -- automatically connects to manager on subnet 255.255.255.0 at port 1234

in either case, you can specify the optional port number should the manager be using a non default port number. Will return true if connection was succesful.

<netManager>.Disconnect()

Disconnects the connection established with <netManager>.connect.

<netManager>.Kill()

Shutsdown the manager. You must have queue control to do this.

<netManager>.QueryControl #wait | #dontwait

This requires either #wait or #dontWait. The function works as follows:

Nobody has queue control: #dontWait returns true, #wait returns true.

Someone has queue control: #dontwait returns false, #wait prompts the current queue controller.

In the last case, the queue controller gets the QueryControl callback, and must indicate if they want control. If that user indicates they want to keep control, then the function returns false, if they will give up control (or the 10 second timeout expires), it returns true. Note that the QueueManager gives a prompt for the user to indicate what they want; in the scripter, you just get the callback and have to use the wantControl value.

Note: Please refer to callback, "#queuecontrol myqueuecontrol", found above in <netManager>.setCallback.

<netManager>.GetControl()

Takes control of the queue. Returns true if control was taken. From that moment on, jobs can be submitted, edited, reprioritized, servers can be removed, until queue control is relinquished.

Note: The current queue controller does not get its QueryControl callback triggered. Instead, they just lose the queue control (unless they also have the queue locked lock). You should always precede a call to GetControl() with a call to QueryControl(true), to be sure if it's OK to do this.

<netManager>.Lock <true | false>

Locks out others from getting queue control; and if they call QueryControl, it will automatically return false. For example, suppose you got control of the queue through the scripter using getcontrol(), someone else who has the queuemanager up in readonly mode can request queuecontrol. Setting lock to true, will disallow anyone else to take control until you until you disconnect from the manager, or until you reset the lock to false. Note that the QueueManager always calls QueryControl to check if it can grab the queue.

<netManager>.SetUpdates <true | false>

This function's usage resembles the Lock() function, in that a boolean value is passed, and you must already have queue control. Setting updates to false will freeze the manager so that it refuses any changes to the queue. It does not affect the callbacks. Fewer Update callbacks will be received, since the job queue is not updating. Use this function when submitting large numbers of changes, and when you want all the changes to take effect at the same time. This will occur when setUpdates is called with a true value.

<netManager>.checkoutputvisibility <path>

Takes 1 argument, a pathname defined as a string, ie "c:\\temp". It verifies that the path exists, returns "The system cannot find the path specified. (0x3)" if the path doesn't exist.

Note: Note that the manager checks this output path relative to itself, not to your local machine. Thus if you pass "C:\\" and you have not shared you C drive, it will return OK (because the manager checks its own C drive). Thus you should use a network name when calling this function, like "\\\\mymachine\\share\\". Also, if the parameter does not end in \\, the functions assumes you're naming a file (not a directory) and checks whether this file could be created. Always include the \\ at the end if you're checking whether a directory is accessible.

Properties

The following properties can be used to get information or set certain properties of the manager.

<netManager>.connected

Returns true if connected to the manager.

<netManager>.netStatus

Returns the status of the manager. Various information about the manager can be gathered through netstatus, see netstatus topic.

<netManager>.wantControl  

If you have QueueControl, and other computers call QueryControl, this indicates whether you want to maintain control, or relinquish it; their call to QueryControl will return whatever you have set for WantControl

<netManager>.haveControl

True, if you currently have QueueControl.

<netManager>.numJobs

Returns the number of jobs in the queue.

<netManager>.numServers

Returns the number of servers.

<netManager>.numGroups

Returns the number of groups.

Working with Jobs

Various functions and properties can be used to access jobs. You can use the GetJobs() function to retrieve an array of all jobs in the queue. The jobs can be filtered in various ways to return an array based on the filter.

Note: Do not call GetJobs() or GetServers() very often, because these are VERY heavyweight methods.

<netManager>.getjobs [filter:#suspended | #complete | #waiting | #started | #error | #name | #handle | #index] [key:<name> | <handle> | <index>]

The latter three filter types require a corresponding key arguement. If used without a filter, returns an array of all jobs in queue. If no jobs are in the queue, an empty array will be returned.

filter:#suspended: Returns an array of all suspended jobs. Returns an empty array #() if no jobs are suspended

filter:#complete: Returns an array of all completed jobs. Returns an empty array #() if no jobs are complete.

filter:#waiting: Returns an array of jobs that are waiting to be rendered or are being rendered. Will return an empty array #() if no jobs are waiting.

filter:#started: Returns an array of jobs that are actually started and being rendered.

filter:#complete: Returns an array of all completed jobs. Returns an empty array #() if no jobs are complete

filter:#error: Returns an array of all jobs experiencing an error. Returns an empty array #() if no jobs have errors

filter:#name: Pass a name as the Key argument; Returns an array of all jobs with the given name. Returns an empty array #() if the no jobs have that name

filter:#handle: Pass a handle as the Key argument; the job with that handle will be returned (as an array with one element). Returns an empty array #() if the no job has that handle

filter:#index: Pass an integer as the Key argument; the job at that index in the queue will be returned (as an array with one element). Returns an empty array #() if the no job exists at that index

Example:

manager.GetControl() --get queue control

manager.SetUpdates false --the queue is now frozen

jobs = manager.GetJobs()

manager.SetUpdates true --the queue is unfrozen

Note: The GetJobs() function could return incorrect results if the Queue is changed while the job information is downloading. SetUpdates is used to guarantee that GetJobs operates without error.

<netManager>.SetJobOrder <array>

Changes the order of the jobs in the queue. The array must contain the same jobs that are contained in the array from .getjobs(), although they can be in different order. You must also have queuecontrol, use .getcontrol() function to take control before setting the job order.

<netManager>.NewJob file:<filename>

Creates a new job instance. It requires a valid max file name, ie a max file that exists somewhere on the hard drive or the network. Returns a job definition if the file exists, undefined if the file can't be found.

Example:

job.newJob file:"file.max" --submitting a file

job.newJob()  --submitting the current scene

Note: Jobs can not have maps included, and render element data will not be available for submitted job but render elements will process correctly. These problems are resent when submitting a job from a file, but not when submitting the current scene.

<job>.GetUpdate()

Updates the information about the selected job. Remember this involves a network interaction, so it's a heavyweight operation

<job>.SendUpdate()

Updates the job in the queue with new job settings. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control. Remember this involves a network interaction, so it's a heavyweight operation.

<job>.Submit() Servers:<array>

Submits a new job to be rendered to the queue. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control. if no servers are provided, then all servers will be assigned to the job.

<job>.Suspend()

Suspends the selected job. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.Resume()

Will cause the job to resume where it left off when it was suspended. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.Restart()

Will restart the job from the beginning. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.Delete()

Will delete the job from the queue. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.AssignServer <server>

Assigns a selected server to the job. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.SuspendServer <server>

Removes a server from the selected job. Must have queuecontrol. Use <netManager>.getcontrol() to get queue control.

<job>.GetServerInfo <integer>

Gets information about a particular server assigned to the job. Requires a server number, 1 based.

<job>.GetRenderElement <index>

Returns information as a data structure about the nth element in the. The <element> structure is defined below. Returns undefined if no element at the index number, eg: el = jobs[1].getrenderelement 1 -- retrieves the 1st element in the 1st job in the queue. With this you can find out if the element is enabled, if filtering is enabled, if atmosphere is applied, if shadows are applied, the element name and the element output filename. The following are the properties that are valid for an element.

<job>.nonconcurrentDriver

Returns true if the output cannot be rendered one frame at a time (like an .MOV file). READ-ONLY.

<job>.uninterruptibleDriver

Returns true if the render cannot be resumed after it is interrupted or suspended.

For example, you cannot render half of an .AVI file, then finish it later. You need to render the whole thing without interruption. Read-only

<element>.enabled  

Returns true if the element is enabled. Can also set it's state.

<element>.filterEnabled  

Returns true if filtering is enabled. Can also set it's state.

<element>.atmosphereApplied  

Returns true if atmosphere is applied. READ-ONLY

<element>.shadowsApplied  

Returns true if shadows are applied. READ-ONLY

<element>.name  

Returns the elements name. Name can be changed.

<element>.output  

Returns the element's output file name. Output name and path can be changed, however, changing the filetype will change the extension of the image but not the actual file type, eg: the current output returned is "\\ej4sf\frames\foo_diffuse.tga", changing the extension to .bmp will just result in the tga file having a .bmp extension instead of the .tga extension.

<job>.SetRenderElement <index> <element>

Sets the selected render element to the new values assigned to the element. In order for the change to take effect in the job, you need to do a <job>.sendupdate() to update the job itself in the queue.

<job>.GetCameras()

Returns an array of cameras in the scene. An empty array #() is returned if no cameras are in the scene.

<job>.GetLog() start:x numLines:y

Returns the log for the job as text. The 'start' and 'numLines' parameters are optional. If you pass no parameters, you get the entire log. If you only pass start, you get every line starting from the given line. If you pass only numLines, then start is assumed to be 0.

<job>.GetFrameInfo <integer>

Returns information, as a data structure, about the nth frame. The index is 1 based. The <frame> structure is defined below.

Example:

fr = getframeinfo 4 -- Returns info about the 4th frame. Read-only.

<frame>.state   

Returns the state of the frame. The state can be #waiting, #assigned or #complete.

<frame>.index   

Returns the actual frame number. Read-only.

<frame>.serverhandle  

Returns the serverhandle. Should return undefined when frame hasn't been rendered yet. Read-only.

<frame>.servername  

Returns the name of the server that is assigned to that frame. Should return undefined if the frame isn't assigned yet. Read-only.

<frame>.elapsedtime

Returns the time it took for the frame to render. Should return undefined if the frame isn't assigned yet. Read-only.

<job>.GetServerStatusText <server>

Returns any messages from the chosen server assigned to the job. Will return an empty string if no messages from the server. Read-only.

<job>.numServers

Returns the number of servers assigned to the job. Read-only.

<job>.state

Returns the state of the job. This can be #complete, #suspended, #busy or #waiting. Read-only.

<job>.serverPID

This function gives low-level information that is intended for internal-use-only.

<job>.handle

Returns the job's handle. Read-only.

Many of the following values are read-write, but changes you make to these values will not register with the manager until you call <job>.SendUpdate().

Note that SendUpdate requires queue control (obtained via <NetManager>.getControl)

<job>.name

Returns the name of the job. The name can be changed.

<job>.filesize

Returns the job's file size.

<job>.filesizeExtracted

Returns the job's extracted file size. Read-only.

<job>.timeSubmitted

Returns the time at which the job was submitted as a string.

<job>.timeStarted

Returns the time at which the job was started as a string. Returns undefined if job hasn't started. Read-only.

<job>.timeFinished

Returns the time at which the job was finished as a sting. Returns undefined if job hasn't finished. Read-only.

<job>.notifications

Returns true if notifications are on. Can be changed.

<job>.notifyFailure

Returns true if notified of failures. Can be changed.

<job>.notifyProgress

Returns true if notified of progress. Can be changed.

<job>.notifyCompletion

Returns true if notified of progress is on. Can be changed.

<job>.notifyFrameInterval

Returns an interval at which notifications occur. Can be changed.

<job>.fromFrame

Returns the rendering start frame. Can be changed.

<job>.toFrame

Returns the rendering end frame. Can be changed.

<job>.nthFrame

Returns the rendering frame interval. Can be changed.

<job>.outputWidth

Returns the width of the rendered frame. Can be changed.

<job>.outputHeight

Returns the height of the rendered frame. Can be changed.

<job>.numFramesComplete

The number of completed frames for the job. Read-only.

<job>.priority

Returns the job priority.

<job>.videoPost

Returns true if there is a video post sequence. Read-only.

<job>.nonconcurrentDriver

Returns true if the output cannot be rendered one frame at a time (like .MOV). Read-only.

<job>.includeMaps

Returns true if the job was submitted with include maps on. Can be changed.

<job>.uninterruptibleDriver

Returns true if the render can't be resumed if it was interrupted or suspended. For an.AVI, you cannot render half the file, then finish it later. You need to render the whole thing without interruption. Read-only.

<job>.skipRenderedFrames

Returns true if skip rendered frames was set to on when job was submitted. Can be changed.

<job>.useAllServers

Returns true if use all servers was set to on when job was submitted. Can be changed

<job>.suspended

Returns true if the job is suspended. Read-only. To suspend the job use <job>.suspend().

<job>.finished

Returns true if the job is finished. Read-only.

<job>.ignoreShare

Returns true if the job was submitted with ignore share on. Can be changed.

<job>.skipOutputTest

Returns true if the job was submitted with skip output test on. Can be changed.

<job>.nonSeqFrames

Returns true if the job was submitted to render non sequential frames. Can be changed.

<job>.combustionJob

Returns false if the job is a max job. Read-only.

<job>.uncompressedFile

Returns false if the job file is compressed. Read-only.

<job>.gammaCorrection

Returns true if the job was submitted with gamma correction on. Can be changed.

<job>.gammaValueIn

Returns a float value of the incomming gamma value. Can be changed.

<job>.gammaValueOut

Returns a float value of the outgoing gamma value. Can be changed.

<job>.renderPixelAspect

Returns a float value of the render pixel aspect ratio. Can be changed.

<job>.renderCamera

Returns a string with the name of the camera view being rendered. Will return an empty string if view being rendered is an non camera view, ie perspective, front, user, etcàCan be changed. Use <job>.getcameras() function to get a list of valid cameras in the scene to change to.

<job>.renderElements

Returns true if a job was submitted with the render elements active. Note that this will return true even there aren't any elements to be rendered. Can be changed.

<job>.numSceneObjects

Returns the number of objects in the scene as an integer. Read-only.

<job>.numSceneFaces

Returns the number of faces in the scene as an integer. Read-only.

<job>.numSceneLights

Returns the number of lights in the scene as an integer. Read-only.

<job>.sceneStartTime

Returns the scene start time in frames, so if your scene is set to use MM:SS:Ticks, this will still return a value in frames.

<job>.sceneEndTime

Returns the scene end time in frames.

<job>.videoColorCheck

Returns true if the job was submitted with videocolorcheck on. Can be changed.

<job>.force2Sided

Returns true if the job was submitted with force 2 sided on. Can be changed.

<job>.renderHiddenObjects

Returns true if the job was submitted with render hidden objects on. Can be changed.

<job>.renderAtmosphericEffects

Returns true if the job was submitted with render render atmospheric effects on. Can be changed.

<job>.superBlack

Returns true if the job was submitted with superblack on. Can be changed.

<job>.serialNumbering

Returns true if nth serial numbering is on this property is accesible through the preferences \ rendering dialog.

<job>.ditherPaletted

Returns true if Dither Paletted was enabled when the job was submitted. Can be changed.

<job>.ditherTrueColor

Returns true if Dither True Color was enabled when the job was submitted. Can be changed.

<job>.renderFields

Returns true if Render Fields was enabled when the job was submitted. Can be changed.

<job>.renderDisplacements

Returns true if displacements was enabled when the job was submitted. Can be changed.

<job>.renderEffects

Returns true if render effects was enabled when the job was submitted. Can be changed.

<job>.fieldOrder

Returns either #odd or #even depending on what the field order was set to when job was submitted. Can be changed.

<job>.numRenderElements

Returns the number of render elements in the scene. Read-only.

<job>.userName

Returns the name of the user, as a string, that submitted the job. Note that if a job is submitted through the scripter using <job>.submit(), and the max file was last saved by another user on a different computer, the username will be that of the other user. Read-only

<job>.computerName

Returns the name of the computer, as a string, that the job was submitted from. Note that if a job is submitted through the scripter using <job>.submit(), and the max file was last saved by another user on a different computer, the computername will be that of the computer on which the max file was last saved. Read-only

<job>.managerShare

Returns the shared folder as a string where all jobs are stored on the manager.

<job>.frames

Returns a string of frames to render, ie "1,3,5-12". Can be changed.

<job>.frameOutputName

Returns the name and path of the output file. Can be changed

<job>.frameOutputGamma

Returns the output gamma of the rendered frames.

<job>.frameOutputDevice

Returns the device name if a device is specified at render time.

<job>.numFrames

Returns the total number of frames for the particular job

Working with Servers

Various functions and properties can be used to access rendering servers. You can use the getservers() function to retrieve an array of all servers managed by the manager. The servers can be filtered in various ways to return an array based on the filter.

Note: Do not to call GetJobs() or GetServers() very often, because these are VERY heavyweight methods.

<netManager>.GetServers [filter:#idle | #busy | #absent | #suspended | #error | #group | #job | #handle | #index] [key:<string> | <integer> | <job> ]

If used without a filter, GetServers() will return an array of all servers managed by the manager. If there are no servers, the function will return an empty array.

filter:#idle: Returns an array of all idle servers

filter:#busy: Returns an array of all servers busy rendering a job

filter:#absent: Returns an array of all servers that are absent, ie that were connected to the manager at one point but that are either down or the server service or serverapp is not running on it.

filter:#suspended: Returns an array of all suspended servers

filter:#error: Returns an array of all servers experiencing an error

filter:#group: Returns an array of servers in a group. Requires that the key option is used, the key can be a group name as a string or a group number as an integer (1 based). An empty array is returned if no groups are defined.

filter:#job: Returns an array of servers that are assigned to the specified job. Requires that the key option be used, the key must be a job definition.

filter:#handle: Returns the server with a given handle (as an array with one item). Requires that the key option be used, the key must be a server handle.

filter:#index: Returns the server at a given index in the server list (as an array with one item). Requires that the key option be used, the key must be an integer (the index).

server = m.getservers()

<server>.GetUpdate()

Gets an update on the state of the server. Returns Ok if succesful.

<server>.SendUpdate()

Updates the server with new settings. Must have queuecontrol.

<server>.Delete()

Deletes the server from the manager. Must have queuecontrol.

<server>.ResetPerformance()

Resets the performance metric to 0.0. Must have queuecontrol and must do <server>.sendupdate() to update the server.

<server>.netStatus

Netstatus

<server>.handle

Returns the server's handle. Read-only

<server>.state

Returns the state of the server, this can be #idle, #absent, #busy

<server>.name

Returns the name of the server. Read-only

<server>.totalFrames

Returns the total number of frames rendered by the server. Read-only

<server>.totalTime

Returns the total time that the server has been up. The value returned is in hours.

<server>.performance

Returns the performance index of the server. Read-only

<server>.AttendedPriority

Returns the priority, as an integer, of the server when the user is logged in.

0: high priority

1: low priority

2: idle.

Can be changed.

<server>.UnattendedPriority

Returns the priority level, as an integer, of the server when the system is logged out.

0: high priority

1: low priority

2: idle.

Note that this is only valid if running serversvc and the user is not logged in on the system. If running serversvc and a user is logged in on the system then the attendedpriority values are in effect. Can be changed.

<server>.schedule

Returns an array of 7 bitarrays. Each bitarray is a day, each bit is an hour, each bit within that bit array means that the server is available at that hour. A bit array of #{1, 3..5, 15..24} means that the server is available from 12 midnight to 1am, from 3am to 5am and from 3pm to midnight.

<server>.jobHandle

Returns the handle ot the job it is working on. Will return a value of 0 if no job is being worked on by that server.

<server>.jobFrameIndex

Returns the frame index of the job that the server is working on.

<server>.jobFrameTimeStarted

Returns the time at which the frame being rendered was started.

Working with Groups

<netManager>.SizeofGroup <index>

Returns the number of servers in the nth group.

<netManager>.GetGroupName<index>

Returns the name of the nth group.

<netManager>.CreateGroup <array> <string>

Creates a named group of servers. It takes 2 arguments: an array of servers and a string to define the group name.

<netManager>.DeleteGroup <string>

Deletes a named group. Takes a string as an argument.

Netstatus

Both manager and servers have a netstatus property. All properties are Read-only.

system = m.netstatus

<system>.SpaceOnDisk <index>

Returns the amount of space in megs on a specified disk. The index is 1 based. Disks 1 and 2 are the a: and b: drives.

<system>.numDroppedPackets

Returns the number of dropped packets.

<system>.numBad

Returns the number of bad packets.

<system>.numTCPRequests

Returns the number of TCP requests

<system>.numUDPRequests

Returns the number of UDP packets

<system>.bootTime

Returns the time at which the system was started.

<system>.memorySize

Returns the amount of memory of the system.

<system>.numProcessors

Returns the number of processors in system machine

<system>.platformID

Returns an integer, a value of 1 indicates win95, a value of 2 indicates WinNT

<system>.majorVersion

Returns an integer. When the platformID indicates a WinNT system, a value of 5 or higher here indicates Win2k.

<system>.minorVersion

Returns an integer. Win98 is indicated by a minor build greater than 0 for win95

<system>.buildNumber

Returns the build number, this only applies to winnt and win2k. Not supported under win95, win98 or win ME.

<system>.CSDVersion

Returns the service pack number of the OS as a string.

<system>.username

Returns the login name of the user logged in on the computer or the login name used by the service.

<system>.tempDir

Returns the tempdir for the system.

<system>.computerName

Returns the name of the computer.

<system>.workdisk

Returns the disk where max is setup.

<system>.Disks

Returns a bitarray of which disks exist (1=A, 2=B, 3=C etc.)

<system>.mac

Returns the MAC address of the system's network card. If the computer is a network server, this is its handle.

Examples:

-- ESTABLISHING A CONNECTION --

m = netrender.getmanager() --get a NetManager instance

--start this session

m.connect #manual "nimbus"

-- OR m.connect #manual "nimbus" port:1234 --specifying a port number

-- QUEUE CONTROL --

--Get QueueControl using GetControl();

--there is no way to release control, but if wantControl==false

--then control will be relinquished to the next client

--that requests it

if( m.QueryControl #wait ) do  --only take control if you have permission

m.getcontrol() --takes queue control

m.wantControl=true --if another client does QueryControl(), they will get a return value of false

m.Lock true --this completely prevents others from getting queue control

m.Lock false --others can now get control

-- SUBMITTING JOBS --

job = m.newjob file:"c:\\share\\test.max"

job.suspended = true --jobs can be submitted as suspended

job.state --should be unsubmitted

job.includeMaps = true  --turn on "Include Maps"

srv_list = m.getservers()  --get the server list to assign to the job

job.submit servers:srv_list  --specify which servers to use for the job

-- job.submit()  --this uses all servers for the job

-- GETTING JOBS & SERVER OBJECTS --

m.SetUpdates false --lock the queue, to make sure nothing changes while you download info

j = m.getjobs filter:#suspended --an array of NetJob objects; filters are optinal

s = m.getservers filter:#idle --an array of NetServer objects; filters are optinal

--see below for other filters... there are many

m.SetUpdates true --be sure to unlock the queue!

-- WORKING WITH GROUPS --

m.creategroup s "myGroup" --takes an array of NetServers and a name

num_groups = m.numGroups --total number of groups

size_group1 = m.SizeofGroup 1 --number of servers in the first group

g = m.getservers filter:#group key:1 --an array of the servers for group 1

g = m.getservers filter:#group key:"myGroup" --an array of the servers for group "myGroup"

g_name = m.GetGroupName 1 --the name of the first group

m.deletegroup g_name --delete a group

-- WORKING WITH JOBS --

job = j[1] --pull a job out of the list

jHandle = job.handle --the job's ID

p = job.priority --job's priority

if job.nonSeqFrames==True then

frames = job.frames --one of those "1,3,5-12" frame lists

else

frames = (job.fromFrame as string) + "-" + (job.toFrame as string)

--now frames is "0-100" if 0 and 100 are the start/end frames

cameraArray = job.GetCameras() --an array of the camera names

l = job.GetLog --the entire log, as text

l = job.GetLog start:4 numLines:2 --gets the 4th and 5th entries of the log

statText = job.GetServerStatusText s[1] --text about a server, regarding this job

num_workers = job.numServers --number of servers on this job

job.frameOutputName = "d:\\blah.bmp" --change the output name

isDevice = job.frameOutputDevice --true if the output is to a device, false otherwise

share = job.managerShare --the manager share for this job

job.filesize --size of the MAZ file for the job

job.filesizeextracted --extracted sisze of the MAZ file for the job

-- WORKING WITH SERVERS --

srv = s[1] --pull a server out of the list

sHandle = srv.Handle --the server's ID

sName = srv.name --the server's machine name

speed = srv.performance --server's performance index

srv.ResetPerformance() --reset the index

timeUsed = srv.totalTime --total time spent rendering

sjHandle = srv.jobHandle --the handle of the server's current job, 0 if none

sjFrameIndex = srv.jobFrameIndex --the index of the frame the server is rendering

--PRACTICAL EXAMPLE;  get info about the frame being rendered

sjHandle = srv.jobHandle

sjIndex = srv.jobFrameIndex

sJobs = m.getJobs filter:job key:sjHandle --should be an array with one entry

frameInfo = (sJobs[1].getFrameInfo sjIndex) --get info about the current frame

frameTime = frameInfo.elapsedTime

-- UPDATES FROM MANAGER --

--Jobs and Servers support GetUpdate and SendUpdate functions,

--  for synchronizing with the manager

job.status --should be busy

job.Suspend()

job.status --still says busy (status value is stale)

job.GetUpdate() --download the latest news

job.status --now says suspended

s[1].GetUpdate() --servers also have Get/SendUpdate

-- CALLBACKS --

-- These are used to listen for messages from the manager,

-- They are functions you can define, that will get called when

--  the manager has something to say

-- There are 6 possible callbacks

-- NOTE: you can name these functions anything you want, but they must have correct paramters

--NETPROGRESS CALLBACK;  Called anytime a download/upload is underway,

--  including anytime you fetch information about jobs or servers

fn myNetProgress total current = --NOTE: two integer parameters

format "Progress: completed % out of %\n" current total

--NETMESSAGE CALLBACK;  Called when the manager has a text message for the user

fn myNetMessage msg = --NOTE: one string parameter

format "Message: %\n" msg

--UPDATE CALLBACK;  Called when something has changed, like a job started or finished

--  Let's you know when you need to make GetUpdate calls, or other refreshing

fn myUpdate =

job.GetUpdate() --example of what you might do

--MANAGERDOWN CALLBACK;  Called when the manager dies

fn myManagerDown =

format "Manager is dead\n"

--QUEUECONTROL CALLBACK;  Called whenever queue control changes

fn myQueueControl =

format "Queue control has changed\n"

--QUERYCONTROL CALLBACK;  Called when you have Queue Control, and another computer wants it

fn myQueryControl clientName = ( --NOTE: one string parameter

format "The computer % wants queue control" clientName

m.wantControl = true -- use this to keep queue control

m.wantControl = false -- use this to release queue control

)

--INSTALLING THE CALLBACKS; after you define the functions, you must give them to the

--  manager as follows

--NOTE: only one callback of each type is allowed (e.g., you can't have two "Update" callbacks)

m.setcallback #Progress myNetProgress --install the "Progress" callback

m.setcallback #Message myNetMessage --install the "Message" callback

m.setcallback #Update myUpdate --install the "Update" callback

m.setcallback #ManagerDown myManagerDown --install the "ManagerDown" callback

m.setcallback #QueueControl myQueueControl --install the "QueueControl" callback

m.setcallback #QueryControl myQueryControl --install the "QueryControl" callback

-- NETSTATUS OBJECTS --

--Read-only information about a computer on the network

stat = s[1].netStatus --get network info about server 1

stat.boottime --make a query

stat.Disks --

d = stat.workDisk --which is the disk for net-rendering work?

stat.SpaceOnDisk d --megabytes of free space on the workdisk

stat.memorySize --computer's memory in bytes (note: 1 meg = 1048576 bytes)

s[1].GetUpdate() --this refreshes the netStatus object

stat = m.netStatus --manager also has a NetStatus

--NOTE: Manager has no GetUpdate(), you must fetch the NetStatus again to see any changes

--To print out the operating system on the machine...

--Win95 has a platformID of 1;  WinNT has a platformID of 2

--Win2K is indicated by a majorBuild of 5 or more for WinNT

--Win98 is indicated by a minorBuild greater than 0 for Win95.

-- Also, build number and the CSDVersion string are not supported by Win95/98

format "Windows %.%, Build %, %\n" \

stat.majorVersion stat.minorVersion stat.buildNumber stat.CSDVersion

-- JOBFRAME OBJECTS --

num_frames = job.numFrames()

frame = job.getFrameInfo 1  --get info about the 1st frame

elapsed_time = frame.ElapsedTime  --amount of time frame has been rendering

num_rendElems = job.numRenderElements() --number of render elements for render

if num_rendElems>0 do (

rendElem = job.GetRenderElement 1 --pass the index of the element

rendElem.enabled = false --turn off the rend element

job.SetRenderElement 1 rendElem --update the job with the new changes

job.SendUpdate() --upload the changes

)

-- JOBSERVER OBJECTS --

--Read-only information about a server, in relation to a particular job

j_num_servers = j[1].numServers --how many servers does the job have?

js = j[1].GetServerInfo 1 --info about the job's first server

sh = js.serverHandle --what's the server's handle?

sn = js.serverName --what's the server's name?

isWorker = js.active --whether this server participates in this job

js_state = js.state --is the server busy with the job?  has an error? etc

--Print out some stats

format "rendering frame %, completed %, total time % hours\n"  \

js.currentFrame js.numFramesComplete js.elapsedTime

--ways to get more info about this server...

jSrv = m.GetServers filter:#handle key:sh --get the actual server object

statText = j[1].GetServerStatusText jSrv[1] --text info from the server about this job

-- RENDERELEMENT OBJECTS --

--Information about particular render elements for a job

n = j[1].numRenderElements --how many render elements for this job?

re = j[1].GetRenderElement 1 --get the first one

re.enabled = false --disable it

re.filterEnabled = false --disable filtering

re.name = "newName" --change its name

useShadows = re.shadowsApplied --are shadows applied?  (read-only)

useShadows = re.atmosphereApplied --are atmospherics applied (read-only)

re.output = "C:\\share\\rendElem1.bmp" --change its output path & name

j[1].SetRenderElement 1 re --update the job with the new changes

j[1].SendUpdate --upload the changes

-- WEEKLY SCHEDULES --

-- a servers' weekly schedule is an array of seven BitArrays;

-- Each bitArray is a day, each bit is an hour

sched = s[1].schedule

sched[1][11] = false --sunday 11am, the server will not work

sched[1][12] = false   --  same for sunday noon

s[1].attendedPriority = 60 --set the priorities for the server's schedule

s[1].unattendedPriority = 10

s[1].schedule = sched --set the new schedule

s[1].schedule --printout to prove the change worked

s[1].SendUpdate() --upload the changes to this server

--NOTE: a Schedule is just a BitArray and has no GetUpdate,

--you must fetch it again from the server to see any changes

-- MISCELANEOUS FUNCTIONS --

jobList = #( j[3], j[1], j[2] ) --make an array of some jobs

m.SetJobOrder jobList --rearrange the jobs;  e.g. j[3] is now the first in the queue

mName = (m.netStatus).computerName --the machine name of the manager

-- JOB & SERVER FILTERS --

jobServers = m.getservers filter:#Job key:j[1]

groupServers = m.getservers filter:#group key:"Clouds"

-- ENDING THE SEESION --

m.wantControl=true --other clients can now get QueueControl

m.disconnect() --end this session

-- m.kill() --brings down the manager, (would need queue control)