def _loadEventIdData(self):
    "\n        Load the last processed event id from the disk\n\n        If no event has ever been processed or if the eventIdFile has been\n        deleted from disk, no id will be recoverable. In this case, we will try\n        contacting Shotgun to get the latest event's id and we'll start\n        processing from there.\n        "
    eventIdFile = self.config.getEventIdFile()
    if (eventIdFile and os.path.exists(eventIdFile)):
        try:
            fh = open(eventIdFile, 'rb')
            try:
                self._eventIdData = pickle.load(fh)
                noStateCollections = []
                for collection in self._pluginCollections:
                    state = self._eventIdData.get(collection.path)
                    if state:
                        collection.setState(state)
                    else:
                        noStateCollections.append(collection)
                if noStateCollections:
                    maxPluginStates = {}
                    for collection in self._eventIdData.values():
                        for (pluginName, pluginState) in collection.items():
                            if (pluginName in maxPluginStates.keys()):
                                if (pluginState[0] > maxPluginStates[pluginName][0]):
                                    maxPluginStates[pluginName] = pluginState
                            else:
                                maxPluginStates[pluginName] = pluginState
                    lastEventId = self._getLastEventIdFromDatabase()
                    for collection in noStateCollections:
                        state = collection.getState()
                        for pluginName in state.keys():
                            if (pluginName in maxPluginStates.keys()):
                                state[pluginName] = maxPluginStates[pluginName]
                            else:
                                state[pluginName] = lastEventId
                        collection.setState(state)
            except pickle.UnpicklingError:
                fh.close()
                fh = open(eventIdFile, 'rb')
                line = fh.readline().strip()
                if line.isdigit():
                    lastEventId = int(line)
                    self.log.debug('Read last event id (%d) from file.', lastEventId)
                    for collection in self._pluginCollections:
                        collection.setState(lastEventId)
            fh.close()
        except OSError as err:
            raise EventDaemonError(('Could not load event id from file.\n\n%s' % traceback.format_exc(err)))
    else:
        lastEventId = self._getLastEventIdFromDatabase()
        if lastEventId:
            for collection in self._pluginCollections:
                collection.setState(lastEventId)
        self._saveEventIdData()
Load the last processed event id from the disk

If no event has ever been processed or if the eventIdFile has been
deleted from disk, no id will be recoverable. In this case, we will try
contacting Shotgun to get the latest event's id and we'll start
processing from there.
def _loadEventIdData(self):
    "\n        Load the last processed event id from the disk\n\n        If no event has ever been processed or if the eventIdFile has been\n        deleted from disk, no id will be recoverable. In this case, we will try\n        contacting Shotgun to get the latest event's id and we'll start\n        processing from there.\n        "
    eventIdFile = self.config.getEventIdFile()
    if (eventIdFile and os.path.exists(eventIdFile)):
        try:
            fh = open(eventIdFile, 'rb')
            try:
                self._eventIdData = pickle.load(fh)
                noStateCollections = []
                for collection in self._pluginCollections:
                    state = self._eventIdData.get(collection.path)
                    if state:
                        collection.setState(state)
                    else:
                        noStateCollections.append(collection)
                if noStateCollections:
                    maxPluginStates = {}
                    for collection in self._eventIdData.values():
                        for (pluginName, pluginState) in collection.items():
                            if (pluginName in maxPluginStates.keys()):
                                if (pluginState[0] > maxPluginStates[pluginName][0]):
                                    maxPluginStates[pluginName] = pluginState
                            else:
                                maxPluginStates[pluginName] = pluginState
                    lastEventId = self._getLastEventIdFromDatabase()
                    for collection in noStateCollections:
                        state = collection.getState()
                        for pluginName in state.keys():
                            if (pluginName in maxPluginStates.keys()):
                                state[pluginName] = maxPluginStates[pluginName]
                            else:
                                state[pluginName] = lastEventId
                        collection.setState(state)
            except pickle.UnpicklingError:
                fh.close()
                fh = open(eventIdFile, 'rb')
                line = fh.readline().strip()
                if line.isdigit():
                    lastEventId = int(line)
                    self.log.debug('Read last event id (%d) from file.', lastEventId)
                    for collection in self._pluginCollections:
                        collection.setState(lastEventId)
            fh.close()
        except OSError as err:
            raise EventDaemonError(('Could not load event id from file.\n\n%s' % traceback.format_exc(err)))
    else:
        lastEventId = self._getLastEventIdFromDatabase()
        if lastEventId:
            for collection in self._pluginCollections:
                collection.setState(lastEventId)
        self._saveEventIdData()