| 172 | return self.argmin |
| 173 | |
| 174 | def wait(self, verbose=False, verbose_print_interval=1.0): |
| 175 | last_print_time = 0 |
| 176 | while True: |
| 177 | self.refresh() |
| 178 | if verbose and last_print_time + verbose_print_interval < time(): |
| 179 | print( |
| 180 | "fmin: %4i/%4i/%4i/%4i %f" |
| 181 | % ( |
| 182 | self.count_by_state_unsynced(JOB_STATE_NEW), |
| 183 | self.count_by_state_unsynced(JOB_STATE_RUNNING), |
| 184 | self.count_by_state_unsynced(JOB_STATE_DONE), |
| 185 | self.count_by_state_unsynced(JOB_STATE_ERROR), |
| 186 | min( |
| 187 | [float("inf")] + [l for l in self.losses() if l is not None] |
| 188 | ), |
| 189 | ) |
| 190 | ) |
| 191 | last_print_time = time() |
| 192 | if self.count_by_state_unsynced(JOB_STATE_NEW): |
| 193 | sleep(1e-1) |
| 194 | continue |
| 195 | if self.count_by_state_unsynced(JOB_STATE_RUNNING): |
| 196 | sleep(1e-1) |
| 197 | continue |
| 198 | break |
| 199 | |
| 200 | def __getstate__(self): |
| 201 | rval = dict(self.__dict__) |