(self, progress: str, no: int = 0, active: bool = True)
| 368 | _lazy_mark_dirty_for_context(ctx.id, reason="log.Log._update_item") |
| 369 | |
| 370 | def set_progress(self, progress: str, no: int = 0, active: bool = True): |
| 371 | progress = self._mask_recursive(progress) |
| 372 | progress = _truncate_progress(progress) |
| 373 | changed = False |
| 374 | ctx = self.context |
| 375 | with self._lock: |
| 376 | prev_progress = self.progress |
| 377 | prev_active = self.progress_active |
| 378 | |
| 379 | self.progress = progress |
| 380 | if not no: |
| 381 | no = len(self.logs) |
| 382 | self.progress_no = no |
| 383 | self.progress_active = active |
| 384 | |
| 385 | changed = self.progress != prev_progress or self.progress_active != prev_active |
| 386 | |
| 387 | if changed and ctx: |
| 388 | # Progress changes are included in every snapshot, but push sync requires a |
| 389 | # dirty mark even when no log items changed. |
| 390 | _lazy_mark_dirty_for_context(ctx.id, reason="log.Log.set_progress") |
| 391 | |
| 392 | def set_initial_progress(self): |
| 393 | self.set_progress("Waiting for input", 0, False) |
no test coverage detected