(self)
| 51 | if hasattr(i, 'start_t')] |
| 52 | |
| 53 | def run(self): |
| 54 | cur_t = self._time() |
| 55 | while True: |
| 56 | # After processing and before sleeping, notify that we woke |
| 57 | # Need to be done just before sleeping |
| 58 | self.woken = cur_t |
| 59 | # Sleep some time... |
| 60 | self.was_killed.wait(self.sleep_interval) |
| 61 | # Quit if killed |
| 62 | if self.was_killed.is_set(): |
| 63 | return |
| 64 | # Then monitor! |
| 65 | # Acquire lock (to access _instances) |
| 66 | with self.tqdm_cls.get_lock(): |
| 67 | cur_t = self._time() |
| 68 | # Check tqdm instances are waiting too long to print |
| 69 | instances = self.get_instances() |
| 70 | for instance in instances: |
| 71 | # Check event in loop to reduce blocking time on exit |
| 72 | if self.was_killed.is_set(): |
| 73 | return |
| 74 | # Only if mininterval > 1 (else iterations are just slow) |
| 75 | # and last refresh exceeded maxinterval |
| 76 | if ( |
| 77 | instance.miniters > 1 |
| 78 | and (cur_t - instance.last_print_t) >= instance.maxinterval |
| 79 | ): |
| 80 | # force bypassing miniters on next iteration |
| 81 | # (dynamic_miniters adjusts mininterval automatically) |
| 82 | instance.miniters = 1 |
| 83 | # Refresh now! (works only for manual tqdm) |
| 84 | instance.refresh(nolock=True) |
| 85 | # Remove accidental long-lived strong reference |
| 86 | del instance |
| 87 | if instances != self.get_instances(): # pragma: nocover |
| 88 | warn("Set changed size during iteration" + |
| 89 | " (see https://github.com/tqdm/tqdm/issues/481)", |
| 90 | TqdmSynchronisationWarning, stacklevel=2) |
| 91 | # Remove accidental long-lived strong references |
| 92 | del instances |
| 93 | |
| 94 | def report(self): |
| 95 | return not self.was_killed.is_set() |
nothing calls this directly
no test coverage detected