(self, print_frequency=1.)
| 356 | return num_new |
| 357 | |
| 358 | def process_until_new(self, print_frequency=1.): |
| 359 | # TODO: process the entire queue for one pass instead |
| 360 | num_new = 0 |
| 361 | if not self.is_active(): |
| 362 | return num_new |
| 363 | print('Sampling until new output values') |
| 364 | iterations = 0 |
| 365 | last_time = time.time() |
| 366 | while self.is_active() and (not num_new): |
| 367 | iterations += 1 |
| 368 | _, binding = self.pop_binding() |
| 369 | readd, is_new = self._process_binding(binding) |
| 370 | if readd is True: |
| 371 | self.push_binding(binding) |
| 372 | elif readd is STANDBY: |
| 373 | self.standby.append(binding) # TODO: test for deciding whether to standby |
| 374 | num_new += is_new |
| 375 | if print_frequency <= elapsed_time(last_time): |
| 376 | print('Queue: {} | Iterations: {} | Time: {:.3f}'.format( |
| 377 | len(self.queue), iterations, elapsed_time(last_time))) |
| 378 | last_time = time.time() |
| 379 | self.readd_standby() |
| 380 | return num_new + self.greedily_process() |
| 381 | |
| 382 | def process_complexity(self, complexity_limit): |
| 383 | # TODO: could copy the queue and filter instances that exceed complexity_limit |
no test coverage detected