def Load(self):
     for event in super(EventFileLoader, self).Load():
         event = data_compat.migrate_event(event)
         events = dataclass_compat.migrate_event(event,
                                                 self._initial_metadata)
         for event in events:
             yield event
Example #2
0
    def _run_values(self, run_to_events):
        """Helper generator to create a single stream of work items.

        The events are passed through the `data_compat` and `dataclass_compat`
        layers before being emitted, so downstream consumers may process them
        uniformly.

        Note that `dataclass_compat` may emit multiple variants of
        the same event, for backwards compatibility.  Thus this stream should
        be filtered to obtain the desired version of each event.  Here, we
        ignore any event that does not have a `summary` field.

        Furthermore, the events emitted here could contain values that do not
        have `metadata.data_class` set; these too should be ignored.  In
        `_send_summary_value(...)` above, we switch on `metadata.data_class`
        and drop any values with an unknown (i.e., absent or unrecognized)
        `data_class`.
        """
        # Note that this join in principle has deletion anomalies: if the input
        # stream contains runs with no events, or events with no values, we'll
        # lose that information. This is not a problem: we would need to prune
        # such data from the request anyway.
        for (run_name, events) in six.iteritems(run_to_events):
            for event in events:
                v2_event = data_compat.migrate_event(event)
                dataclass_events = dataclass_compat.migrate_event(
                    v2_event, experimental_filter_graph=True
                )
                for dataclass_event in dataclass_events:
                    if dataclass_event.summary:
                        for value in dataclass_event.summary.value:
                            yield (run_name, event, value)
Example #3
0
 def Load(self):
     while self.items:
         event = self.items.pop(0)
         event = data_compat.migrate_event(event)
         events = dataclass_compat.migrate_event(event,
                                                 self._initial_metadata)
         for event in events:
             yield event
Example #4
0
 def _ProcessEvent(self, event):
     """Called whenever an event is loaded."""
     event = data_compat.migrate_event(event)
     events = dataclass_compat.migrate_event(event)
     for event in events:
         self._ProcessMigratedEvent(event)