def bulk_record_workunits(self, engine_workunits):
    """A collection of workunits from v2 engine part"""
    for workunit in engine_workunits:
      duration = workunit['end_timestamp'] - workunit['start_timestamp']

      span = zipkin_span(
        service_name="pants",
        span_name=workunit['name'],
        duration=duration,
        span_storage=self.span_storage,
      )
      span.zipkin_attrs = ZipkinAttrs(
        trace_id=self.trace_id,
        span_id=workunit['span_id'],
        # TODO change it when we properly pass parent_id to the v2 engine Nodes
        # TODO Pass parent_id with ExecutionRequest when v2 engine is called by a workunit
        # TODO pass parent_id when v2 engine Node is called by another v2 engine Node
        parent_span_id=workunit.get("parent_id", self.parent_id),
        flags='0', # flags: stores flags header. Currently unused
        is_sampled=True,
      )
      span.start()
      span.start_timestamp = workunit['start_timestamp']
      span.stop()
def bulk_record_workunits ( self , engine_workunits ) : for workunit in engine_workunits : duration = workunit [ 'end_timestamp' ] - workunit [ 'start_timestamp' ] span = zipkin_span ( service_name = "pants" , span_name = workunit [ 'name' ] , duration = duration , span_storage = self . span_storage , ) span . zipkin_attrs = ZipkinAttrs ( trace_id = self . trace_id , span_id = workunit [ 'span_id' ] , parent_span_id = workunit . get ( "parent_id" , self . parent_id ) , flags = '0' , is_sampled = True , ) span . start ( ) span . start_timestamp = workunit [ 'start_timestamp' ] span . stop ( )
A collection of workunits from v2 engine part