module libpyRR2

Parent Previous Next



Module libpyRR2

The module libpyRR2 is a standalone/external module.

You can load/import it into any Python environment, e.g. Houdini or rrPythonconsole.



Module libpyRR2 classes and functions:

Type

Name

Description

char * 

getRRModuleVersion()

Requires to call any jobGet..() function.

_rrTCP

_rrTCP("") 

Creates a _rrTCP instance. You should NOT create multiple _rrTCP instances. (There are exceptions if you really know what you do).

_dataIDs

_dataIDs

enumeration _dataIDs

_filterIDs

_filterIDs

enumeration _filterIDs

_sortIDs

_sortIDs

enumeration _sortIDs






Class _rrTCP


Class _rrTCP parameter:

Return type

Name

Description

_rrTCPjobList

jobs

Requires to call any jobGet..() function.

_rrTCPclientList

clients

Requires to call  clientGetList() first

_rrTCPuser

users

Requires to call userGet() first



Class _rrTCP functions:

Return type

Name

Description

string

getRRServer()

This function tries to get the rrServer name or IP from the RR folder in your company.

It uses the RR_ROOT environment variable installed by rrWorkstationInstaller.

Therefore it does only work in your company.

If you want to connect from outside your company, you have to use a DynDNS service.

bool

setServer (string server, int serverPort)

Sets the server IP or name for all TCP connections.


setLogin (string user, string password)

Sets the login to retrieve any data from the rrServer. 


This is required if one of the following configuration options apply  (rrConfig, tab logins):

  • "Authorization required for all connections" is enabled.
  • "Trusted local intranet IP whitelist" is set and you are outside this IP range. 



If an authorization is not required, you may or may not set a user name.

But if you use setLogin() with a password, then the user has to exist.



Special "Authorization String" user:

Pre/Preview/Done/Finished-Script can use the jobs "Authorization String" user.

This user can be used to send commands to that job or retrieve the whole job class with all data.

Note: You can restrict the commands that can be executed in rrConfig, tab logins, User  **rrScriptAuth** 


Please see any python script in folder RR\render_apps\_prepost_scripts\ (and subfolder) for AuthStr examples.



bool

connectAndAuthorize()

After you have have used setLogin(), call this function to login at the rrServer and verify the user/password.

string

errorMessage()

If there was any error, then this function will return a non-empty string


Job Functions



jobList_SetFilter ([string user], [string project], [string renderApp], [string contains], [int filter])

jobSetFilter() controls which jobs are send from the rrServer. You should always use is if you have a lot of jobs in the queue to reduce network traffic,  rrServer workload and python memory usage.
Filter is a bit mask of enumeration _filterIDs values. Use  |   to combine multiple filters. (+ is possible, but | works fine even if you combine the same value multiple times)

bool 

jobList_GetMinInfo

Retrieves all jobs as _JobMinInfo class. 
jobSetFilter() has no influence as it gets all jobs.

bool

jobList_GetBasic (UInt64 jobID)

This function has two modes:
1) jobID is 0 or not set:
    You need to call jobSetFilter() first to get only jobs with that you need to reduce network traffic.
    It updates all jobs that match the filter with the job class _jobBasics.


2) jobID is set:
    It updates this jobs with the job class _jobBasics.

Note: This function executes jobList_GetMinInfo() as well.

bool

jobList_GetSend (UInt64 jobID)

This function has two modes:
1) jobID is 0 or not set:
    You need to call jobSetFilter() first to get only jobs with that you need to reduce network traffic.
    It updates all jobs that match the filter with the job class _jobSend.


2) jobID is set:
    It updates this jobs with the job class _jobSend.

Note: This function executes jobList_GetMinInfo() as well.

bool

jobSendCommand (list<UInt64> jobIDs, rrJob._logMessage commandID, int64 parameter )

jobIDs is a list with JobIDs of jobs that you want to send a command to.

Please check errorMessage() if the function returns false.

bool

jobModify (list<UInt64> jobID, _SettingsOnly settings, _SettingsOnly changeFlags)

jobIDs is a list with JobIDs of jobs that you want to change.

You need to call rrJob.getClass_SettingsOnly() to get a _SettingsOnly class.


This function uses two _SettingsOnly classes. The settings parameter is the one with all the new values you want to set.


The changeFlags tells RR which parameters you want to change. E.g. if you want to change the user name for all jobs, but all jobs should keep their sequence start-end.

To let RR know that you want to change this value, just assign a value to them. (bool values to true, integer to 1, strings to e.g. "1".)


If the function returns false, then please check errorMessage().

bool

jobSubmitNew(_JobBasics newJob, string overrideParameter)

Submits a new job to the rrServer.

We recommend that you use .xml files and use the rrSubmitterconsole.

As the rrSubmitterconsole does many checks and conversions.

Use this function only if you know all required settings for your jobs (e.g. imageFileNameVariables for Maya jobs

See RR/SDK/external/submit.py for an example script.

rrTime

lastUpdateJobs_ServerTime()

Returns the time the rrServer had when jobGetInfoBasic() or jobGetInfoSend() was called.
If it was copied before the job list was retrieved, then it can be used to check which was was changed.

rrTime

lastUpdateJobs_OurTime()

Returns the time this machine had had when jobGetInfoBasic() or jobGetInfoSend() was called.


Client Functions


bool

clientGetList ()

Gets all Clients. The result is put into the .clients parameter.

bool

clientSendCommand (list<bool> clientArray, _ClientCommand ID, [string param])

Sends a command to rrClients.

clientArray is a list with client IDs. If the list has only one element and the ID is -1, then the command is applied to all clients.

param is an optional string parameter. It can be used to send commandlines to the client with the commandID _rrTCP._ClientCommand.cCommandLine


If the function returns false, then please check errorMessage().

_ClientGroup

clientGetGroups()

Get the list of all rrClient groups with their members.  **RR version 9 required**


User Functions


bool

userGet ([string user])

Gets all or only a specified user.

The result of this request is filled into the .user parameter.

bool

userModify (_rrUserSettings user)

After you retrieved a _rrTCPuser class and changed a few values, you have to send that user back to the rrServer/rrConfig. 


If the password is empty, then it will not be changed by the rrServer.


Returns false if there was an error.

Use userWasPartialFail() to know if all settings have been applied.

The rrServer sends the user class back with the current values.

bool

userNew (_rrUserSettings user)

After you got a new user via getNewUserPreset(), you have to send it to the rrServer/rrConfig.


Returns false if there was an error.

Use userWasPartialFail() to know if all settings have been applied.

The rrServer sends the user class back with the current values.

bool

userWasPartialFail()

In case userNew or userModify has not been able to set all setting.

E.g. a user can change its own PW, but he is not able to change his rights if he is not an admin.


Statistics Functions


bool

infoGetGlobalInfo ()


int

getMemUsage ()

Returns the current memory usage of _rrTCP

string

connectionStats ()

connectionStatsJSON ()

Information about the last connections.



Class _rrTCPuser

Class _rrTCPuser functions:

Return type

Name

Description

_rrUserSettings

at (int userID )


_rrUserSettings

getNewUserPreset ()


_rrUserSettings

getAnonymous ()


_rrUserSettings

getOurUser ()

Requires to call setLogin() and any userGet("someuser")  call before.

int

count()

Number of users in this class.


Note: The rrServer will NOT send any passwords.

As there is no need that any external app is able to decode passwords of all users.

Class _rrUserSettings

Class _rrUserSettings parameter:

Return type

Name

Description

rrString

name


rrString8

emailAddress


rrString

userGroup


bool

emailStatus


bool

emailError


rrTime

userAdded




Class _rrTCPjobList


_rrTCPjobList holds an array of jobs that you have requested via jobGetInfo...()

There are 4 possible data classes for jobs. You can check it with getJobDataType().




Example:


print(tcp.jobs.getJobDataType(xxxxxxx))        returns jlNone for all jobs.


tcp.jobSetFilter("UserX","","","",rrLib._filterIDs.isAll); 

tcp.jobGetInfoBasic():

print(tcp.jobs.getJobDataType(xxxxxxx))        returns jlBasic for all jobs of UserX. jlMinInfo for all other jobs.


tcp.jobSetFilter("UserAAA","","","",rrLib._filterIDs.isAll); 

tcp.jobGetInfoSend():

print(tcp.jobs.getJobDataType(xxxxxxx))        returns jlSend for all jobs of UserAAA. jlBasic for all jobs of UserX, but the data is old.  jlMinInfo for all other jobs.


tcp.jobSetFilter("UserWWW","","","",rrLib._filterIDs.isAll); 

tcp.jobGetInfoBasic():

print(tcp.jobs.getJobDataType(xxxxxxx))        returns jlBasic for all jobs of UserWWW.  jlSend for all jobs of UserAAA, but the data is old. jlBasic for all jobs of UserX, but the data is old.  jlMinInfo for all other jobs.




Class _rrTCPjobList functions:

Return type

Name

Description


sort (_sortIDs sortID)

Sorts all jobs in your filtered list.

_dataIDs

getJobDataType (UInt64 jobID)

Tells you which data class is currently available for that job.

_JobMinInfo

getJobMinInfo (UInt64 jobID)


_JobBasics

getJobBasic (UInt64 jobID)

If there is no _JobBasics for this job, then an empty job is returned. It has some fields like scene name set to ??..

_JobSend

getJobSend (UInt64 jobID)

If there is no _JobSend for this job, then it returns getJobBasic()

rrTime

getJobUpdatedTime(UInt64 jobID)

Returns the time this job object was updated by jobGetInfoBasic() or jobGetInfoSend(). The time is the rrServer time.

Note: This is not the last time the job was changed. Use job.lastSettingsChanged or job.lastInfoChanged to get that information.

int

getMaxJobs ()

Total number of jobs in RR

_JobMinInfo

getJobMinInfo_queue (int ID)

for a loop with  getMaxJobs(), returns NULL if queueID is invalid

int

getMaxJobsFiltered ()

Total number of jobs in your filtered list

_JobMinInfo

getJobMinInfo_filterQueue (int ID)

for a loop with  getMaxJobsFiltered()




enumeration _dataIDs


jlNone

0

jlMinInfo

1

jlBasic

2

jlSend

3



enumeration _filterIDs



bit value

hex value

isIdle

00000001

0x01

isRendering

00000010

0x02

isDisabled

00000100

0x04

isWaitFor

00001000

0x08

isFinished

00010000

0x10

isAll

11111111

0xFF



enumeration _sortIDs


sQueue

0

sUser

1

sDateSend

2

sPriority

3

sProject

4

sCustomName

5

sRenderApp

6

sApproved

7

sFramesLeft

8

sFramesDone

9

sTimeRemaining

10

sStatus

11

sScene

12

sLayer

13

sCamera

14

sFrameTime

15


Class _rrTCPclientList


Class _rrTCPclientList functions:

Return type

Name

Description

int

count()

Total number of clients in RR

string

clientStatus(int clientID)


_ClientStatus

at(int clientID)