| 15545 | return cast(str, metrics) |
| 15546 | |
| 15547 | def run_loop(self) -> None: |
| 15548 | while True: |
| 15549 | with self.condition: |
| 15550 | while not self.closed and not self.commands and self.scheduler.is_idle(): |
| 15551 | self.condition.wait() |
| 15552 | if self.closed and not self.commands and self.scheduler.is_idle(): |
| 15553 | return |
| 15554 | commands = list(self.commands) |
| 15555 | self.commands.clear() |
| 15556 | for command in commands: |
| 15557 | command() |
| 15558 | progressed = self.scheduler.step() |
| 15559 | if progressed: |
| 15560 | continue |
| 15561 | with self.condition: |
| 15562 | if self.closed and not self.commands and self.scheduler.is_idle(): |
| 15563 | return |
| 15564 | if not self.commands: |
| 15565 | self.condition.wait(timeout=0.01) |
| 15566 | |
| 15567 | def submit_request( |
| 15568 | self, |