| 130 | run_context.request_stop() |
| 131 | |
| 132 | def end(self, session): |
| 133 | if self._save_thread: |
| 134 | logging.info("Waiting for any pending checkpoints to finish.") |
| 135 | self._save_thread.join() |
| 136 | if self._write_graph_thread: |
| 137 | logging.info("Waiting for any pending write_graph to finish.") |
| 138 | self._write_graph_thread.join() |
| 139 | |
| 140 | last_step = session.run(self._global_step_tensor) |
| 141 | |
| 142 | if self._last_checkpoint_step != last_step: |
| 143 | self._save(session, last_step, asynchronous=False) |
| 144 | |
| 145 | for l in self._listeners: |
| 146 | l.end(session, last_step) |
| 147 | |
| 148 | def _save(self, session, step, asynchronous=True): |
| 149 | """Saves the latest checkpoint, returns should_stop.""" |