Event plugin help

Hi
I’m just starting to set up a event plugin for cinema4d:

[code]from Deadline.Events import *
from Deadline.Scripting import *

######################################################################

This is the function that Deadline calls to get an instance of the

main DeadlineEventListener class.

######################################################################
def GetDeadlineEventListener():
return TestEvent()

######################################################################

This is the function that Deadline calls when the event plugin is

no longer in use so that it can get cleaned up.

######################################################################
def CleanupDeadlineEventListener( deadlinePlugin ):
deadlinePlugin.Cleanup()

######################################################################

This is the main DeadlineEventListener class for TestEvent.

######################################################################
class TestEvent (DeadlineEventListener):

def __init__( self ):
    # Set up the event callbacks here
    self.OnJobSubmittedCallback += self.OnJobSubmitted
    self.OnJobFinishedCallback += self.OnJobFinished
    self.OnJobStartedCallback += self.OnJobStarted
    self.OnSlaveRenderingCallback += self.OnSlaveRendering
    self.OnJobRequeuedCallback += self.OnJobRequeued


def Cleanup( self ):
    del self.OnJobSubmittedCallback
    del self.OnJobFinishedCallback
    del self.OnJobStartedCallback
    del self.OnSlaveRenderingCallback
    del self.OnJobRequeuedCallback

def OnJobRequeued( self, job ):
    if job.JobPlugin != "Cinema4D":
        return
    else:
        ClientUtils.LogText( "!!!!!!!!!!!!!!!! C4D Requed" )

def OnJobStarted( self, job ):
    if job.JobPlugin != "Cinema4D":
        return
    else:
        ClientUtils.LogText( "!!!!!!!!!!!!!!!! C4D Started" )

def OnSlaveRendering( self, job ):
    if job.JobPlugin != "Cinema4D":
        return
    else:
        ClientUtils.LogText( "!!!!!!!!!!!! C4D Job Rendering" )

def OnJobSubmitted( self, job ):
    if job.JobPlugin != "Cinema4D":
        return
    else:
        ClientUtils.LogText( "!!!!!!!!!!!! C4D Job Submitted" )

def OnJobFinished( self, job ):
    if job.JobPlugin != "Cinema4D":
        return
    else:
        ClientUtils.LogText( "!!!!!!!!!!!! C4D Job Finished" )[/code]

But when i run it i get this error:

2015-05-21 14:52:04: An error occurred in the "OnSlaveRendering" function in events plugin 'TestEvent': TypeError : OnSlaveRendering() takes exactly 2 arguments (3 given) (Python.Runtime.PythonException)

In the Scripting reference it says that the “OnSlaveRenderingCallbak” takes 2 parameters:

GenericDelegate2< string, Job > 	OnSlaveRenderingCallback

What is the string parameter supposed to be?
I can’t figure out what i’m doing wrong here :slight_smile:

Any help appreciated.

Cheers
Bonsak

Strange that it’s complaining about 3 args?

Can you try this?

def OnSlaveRendering( self, slaveName, job ):

I’ll ask if we can improve our scripting docs as well…

If it’s an instance method, it will always be passed an implicit first argument of self, so this isn’t surprising. Your modified method signature is correct.

This works!

OnSlaveRendering( self, slaveName, job )

I’m guessing that all the “string” paramterers for all the different slave callbacks in the DeadlineEventListener class should be “slaveName”?

Speaking of the scripting docs. When listing the “Member Function Documentation”, do you have to print the full path to the class when your already on the class page?

Deadline.Events.DeadlineEventListener.OnSlaveRenderingCallback
Is alot harder to read than:

OnSlaveRenderingCallback

Isn’t it obvious that your’e reading the methods for the “Deadline.Events.DeadlineEventListener” class?
I’ve alway found Doxygen docs really hard to read as the typographic styling and use of colors is not very well thought out. So a little cleanup would go a long way :slight_smile:

Cheers
Bonsak

Yep.

An internal ticket has been logged to see what can be done to improve the docs in this area. I’m not an expert on the Doxygen formatting & configuration, but I’ll add your feedback to the ticket now for you.

Sweet!

-b