Class initializer. Args: reader: The underlying reader object doing the actual read. duration: Number of seconds to read. If un-specified, None, or <= 0, the class reverts to a normal reader except that it also produces a data_finished
(self, reader, duration=0)
| 457 | the data steam. |
| 458 | """ |
| 459 | def __init__(self, reader, duration=0): |
| 460 | """Class initializer. |
| 461 | |
| 462 | Args: |
| 463 | reader: The underlying reader object doing the actual read. |
| 464 | duration: Number of seconds to read. If un-specified, None, or <= 0, |
| 465 | the class reverts to a normal reader except that it also |
| 466 | produces a data_finished blob as a side effect to indicate |
| 467 | whether the input stream is exhausted. |
| 468 | """ |
| 469 | super().__init__(reader) |
| 470 | |
| 471 | self.timer = None |
| 472 | self.duration = duration |
| 473 | self.duration_ns_blob = None |
| 474 | |
| 475 | def setup_limiter(self, global_init_net, global_finish_net): |
| 476 | if self.duration is not None and self.duration > 0: |