(self, run_context, run_values)
| 369 | return savers[0] |
| 370 | |
| 371 | def after_run(self, run_context, run_values): |
| 372 | del run_values |
| 373 | if not self._heartbeat_supported: |
| 374 | return |
| 375 | |
| 376 | lame_workers = self._workers.lame_workers() |
| 377 | |
| 378 | if lame_workers: |
| 379 | logging.info('ShutdownHook: lame workers found: %s', lame_workers) |
| 380 | |
| 381 | if self.saver(): |
| 382 | logging.info('ShutdownHook: saving checkpoint to %s', |
| 383 | self._checkpoint_prefix) |
| 384 | self.saver().save( |
| 385 | run_context.session, |
| 386 | self._checkpoint_prefix, |
| 387 | global_step=training_util.get_global_step(), |
| 388 | write_state=True, |
| 389 | ) |
| 390 | else: |
| 391 | logging.info('ShutdownHook: no Saver defined.') |
| 392 | |
| 393 | for fn in self._on_shutdown_hooks: |
| 394 | fn(run_context, self._workers, lame_workers) |
| 395 | |
| 396 | |
| 397 | class ResetComputation(object): |
nothing calls this directly
no test coverage detected