Event error (...): Object reference not set

Hello,

I am trying to implement a few custom events. A coworker already wrote a script that handled the OnJobSubmitted event. First I decided to write a separate script to handle the OnJobFailed event (for structure reasons). The event was handled just fine, but suddenly errors started showing up in deadline like this:

Event Error (OnJobSubmitted): Object reference not set to an instance of an object.

This was for the event plugin that I wrote, which is weird because in my entire script I never added or touched the OnJobSubmitted event. I wrote an extra eventhandler for OnJobSubmitted wich just passed the event and then I started getting the same error for (for example) the OnJobStarted event.
So when I couldn’t fix that, I decided, because my coworkers script ran just fine and he didn’t add any additional event as well, to add my code to his plugin and make sure that there were now 2 eventhandlers in his code.

The plugin did what it should do, but now errors showed up in deadline for my coworkers plugin for the OnJobStarted, OnJobFinished and OnJobError events. My coworkers script didn’t show this errors before.

Can some one help me? If you need my code for this:

############################################################### 
# Imports 
############################################################### 
from Deadline.Events import *
from Deadline.Scripting import *
import os
import json
import datetime

def GetDeadlineEventListener(): 
    ''' Return an instance of the event listener '''
    plugin_listener = PluginListener()
    return plugin_listener

def CleanupDeadlineEventListener(eventListener):
    ''' Free items set by Python as they can leak with Python.net '''
    eventListener.Cleanup()


class PluginListener(DeadlineEventListener):
    def __init__(self):
        self.OnJobFailedCallback += self.OnJobFailed

    def Cleanup(self):
        del self.OnJobFailedCallback

    def OnJobFailed(self, job):
        current_dir = RepositoryUtils.GetRootDirectory()
        path_output_json = os.path.normpath(
            os.path.join(current_dir,
                         'custom/events/Auto-Assign/Failed-Log.json'))
        # read data
        data_file = None
        try:
            data_file = open(path_output_json, 'r')
            data = json.load(data_file)
        except ValueError:
            data = []
        finally:
            if data_file:
                data_file.close()

        # generate data
        timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        batch = job.JobBatchName
        tags = job.JobExtraInfo8
        name = job.JobName
        limits = list(job.JobLimitGroups)
        print('read attr complete')

        new_entry = dict(
            Timestamp=timestamp,
            Batch=batch,
            Tags=tags,
            Name=name,
            Limits=limits
        )
        data.append(new_entry)

        # write
        data_file = open(path_output_json, 'w')
        try:
            json.dump(data, data_file, indent=4)
        finally:
            data_file.close()

We’ve been seeing a few issues lately with undefined events trying to trigger in more recent service packs (not sure of the cause yet). What version are you on at the moment? Can you go to “About” under “Help” (Windows / Linux) or “DeadlineMonitor8” (Mac) and paste the versions here? I’m most interested in the “Deadline Client Version” and it should look something like this:

Deadline Client Version: 8.0.12.4 Release (8a0444567)

As Edwin said, make sure you are upgraded to the latest version but you also need to make sure every slave is also on this version which you can view from the slave list. Any slaves that are not upgraded will continue to throw the error.

Apparently I didn’t get any notifications of your answers, I’m sorry for the late response.
These are the versions:
Repository Version: 8.0.13.3 (2c55876a9)
Integration Version: 8.0.13.3 (2c55876a9)
Deadline Client Version: 8.0.13.3 Release (2c55876a9)

But indeed some of the slaves aren’t fully updated yet. We’ll
look into that this weekend and come back with the results.

Thanks for the help.

Also, I’ve noticed that if the script has import errors that it will throw this exception for any event. That is absolutely not the problem here, but if others see it, check to make sure there are no typos in your imports or try loading it through deadlinecommand as that should provide some helpful hints (already tried with the OP script, no troubles).

We’re still working on this one internally too, so if anyone else can reliably reproduce, please let me know!

Update: I ran this through Deadline 8.0.14.1 and had no problems…