Failed bit on items

2 views
Skip to first unread message

Kevin Campbell

unread,
May 22, 2012, 11:02:38 AM5/22/12
to total-im...@googlegroups.com
Just a note from our discussion, we are setting the None value on lookup failures, or at least the code is there to do so.

    def process_item(self, item):

        (success, metrics) = self.process_item_for_provider(item,
            self.provider, 'metrics')
       
        ts = str(time.time())

        if success:
            if metrics:
            ...
        else:
            # metrics failed, write None values in for the metric
            # values so we don't attempt to reprocess this item
            for metric_name in self.provider.metric_names():
                if not item.metrics.has_key(metric_name):
                    item.metrics[metric_name] = {}
                    item.metrics[metric_name]['values'] = {}
                item.metrics[metric_name]['values'][ts] = None
                item.metrics[metric_name]['static_meta'] = {} #self.provider

We did have an issue before about None values being recorded as empty objects. If that still exists, I expect it's an issue in the save / to_xml methods on the Item object, which may be converting None values to empty objects when updating an object.

K


Reply all
Reply to author
Forward
0 new messages