Event Plugins - Changing job Extra Info onJobSubmitted?

Discussion and Support of Deadline, the Render Management System
squeakybadger
Posts: 84
Joined: Tue Jul 28, 2009 9:50 am

Event Plugins - Changing job Extra Info onJobSubmitted?

Postby squeakybadger » Thu Jul 13, 2017 4:45 am

Hi,

Are the Extra Info Key/Value Pairs for jobs exposed to the event plugins?

I'm using the OverrideJobName example to change job properties, but have only found reference to JobExtraInfo0-9 in the scripting guide.

extrainfo.JPG
extrainfo.JPG (30.34 KiB) Viewed 76 times


I want to be able to force in some quick draft options once the job has been submitted to the Deadline queue.

Thanks.

User avatar
MikeOwen
Posts: 3492
Joined: Thu Jul 19, 2007 5:00 am
Location: London, UK
Contact:

Re: Event Plugins - Changing job Extra Info onJobSubmitted?

Postby MikeOwen » Thu Jul 13, 2017 5:01 am

Here you go (assuming you have first obtained the job object):

Code: Select all

Job.GetJobExtraInfoKeys()

https://docs.thinkboxsoftware.com/produ ... 5f238de049

Code: Select all

Job.GetJobExtraInfoKeyValue( key )

https://docs.thinkboxsoftware.com/produ ... a865a759d5
Mike Owen
Solutions Architect
Thinkbox / AWS

JTB_MPS
Posts: 14
Joined: Fri Jul 07, 2017 5:35 pm

Re: Event Plugins - Changing job Extra Info onJobSubmitted?

Postby JTB_MPS » Mon Jul 17, 2017 12:51 pm

Jumping in on this:

Here you go (assuming you have first obtained the job object):


How does one get any information based on the job itself inside events? I have the job as an argument in the callback, but I get errors when accessing its methods:

Code: Select all

    def OnJobFinished( self, job ):
        self.LogInfo("Job finished!")
        # ^ prints just fine, so the event is properly triggering.
        self.LogInfo("Job argument is type %s" % type(job))
        # INFO: Job argument is type <class 'Deadline.Jobs.Job'> (also prints just fine, so it's found it's class)
        self.LogInfo(job.JobId)
        # INFO: 596cf17fc0854163063b9e9f
        self.LogInfo(job.GetJobEnvironmentKeys())
        # TypeError : No method matches given arguments
        pass


The above is from a custom event I've built based on examples from Deadline documentation. As shown in the commented lines above, these are the returns for each line. Based on this page, I should be able to access that object and grab its properties. Why do I get the "No method matches given arguments" error? Especially since I can grab those properties just fine?

JTB_MPS
Posts: 14
Joined: Fri Jul 07, 2017 5:35 pm

Re: Event Plugins - Changing job Extra Info onJobSubmitted?

Postby JTB_MPS » Mon Jul 17, 2017 1:29 pm

Here's the entire code:

Code: Select all

from Deadline.Events import *

######################################################################
## This is the function that Deadline calls to get an instance of the
## main DeadlineEventListener class.
######################################################################
def GetDeadlineEventListener():
    return MpsEvent()

######################################################################
## 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 MyEvent.
######################################################################
class MpsEvent (DeadlineEventListener):

    def __init__( self ):
        # Set up the event callbacks here
        self.OnJobFinishedCallback += self.OnJobFinished

    def Cleanup( self ):
        del self.OnJobFinishedCallback


    def OnJobFinished( self, job ):
        # TODO: Connect to pipeline site to notify it that the job for a particular
        # shot or task is complete.
        self.LogInfo("Job finished!")
        self.LogInfo("Job argument is type %s" % type(job))
        # INFO: Job argument is type <class 'Deadline.Jobs.Job'>
        self.LogInfo(job.JobId)
        # INFO: 596d0135c0854163063b9ea2
        self.LogInfo(job.GetJobEnvironmentKeys())
        # TypeError : No method matches given arguments
        pass

JTB_MPS
Posts: 14
Joined: Fri Jul 07, 2017 5:35 pm

Re: Event Plugins - Changing job Extra Info onJobSubmitted?

Postby JTB_MPS » Mon Jul 17, 2017 1:43 pm

Sorry, nevermind, figured that out. it was the self.LogInfo function throwing the error, not the Job class. It didn't know how to handle a list.

Thanks, all.


Return to “Thinkbox Software - Deadline”

Who is online

Users browsing this forum: No registered users and 1 guest