MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / stop

Method stop

tensorflow/python/training/supervisor.py:810–847  ·  view source on GitHub ↗

Stop the services and the coordinator. This does not close the session. Args: threads: Optional list of threads to join with the coordinator. If `None`, defaults to the threads running the standard services, the threads started for `QueueRunners`, and the threads sta

(self,
           threads=None,
           close_summary_writer=True,
           ignore_live_threads=False)

Source from the content-addressed store, hash-verified

808 return looper
809
810 def stop(self,
811 threads=None,
812 close_summary_writer=True,
813 ignore_live_threads=False):
814 """Stop the services and the coordinator.
815
816 This does not close the session.
817
818 Args:
819 threads: Optional list of threads to join with the coordinator. If
820 `None`, defaults to the threads running the standard services, the
821 threads started for `QueueRunners`, and the threads started by the
822 `loop()` method. To wait on additional threads, pass the list in this
823 parameter.
824 close_summary_writer: Whether to close the `summary_writer`. Defaults to
825 `True` if the summary writer was created by the supervisor, `False`
826 otherwise.
827 ignore_live_threads: If `True` ignores threads that remain running after a
828 grace period when joining threads via the coordinator, instead of
829 raising a RuntimeError.
830 """
831 self._coord.request_stop()
832 try:
833 # coord.join() re-raises the first reported exception; the "finally"
834 # block ensures that we clean up whether or not an exception was
835 # reported.
836 self._coord.join(
837 threads,
838 stop_grace_period_secs=self._stop_grace_secs,
839 ignore_live_threads=ignore_live_threads)
840 finally:
841 # Close the writer last, in case one of the running threads was using it.
842 if close_summary_writer and self._summary_writer:
843 # Stop messages are not logged with event.step,
844 # since the session may have already terminated.
845 self._summary_writer.add_session_log(SessionLog(status=SessionLog.STOP))
846 self._summary_writer.close()
847 self._graph_added_to_summary = False
848
849 def request_stop(self, ex=None):
850 """Request that the coordinator stop the threads.

Callers 15

trainFunction · 0.95
testBasicsMethod · 0.95
testSessionConfigMethod · 0.95
testNoLogdirSucceedsMethod · 0.95
testInitOpMethod · 0.95
testInitFnMethod · 0.95
testLocalInitOpMethod · 0.95

Calls 4

closeMethod · 0.65
request_stopMethod · 0.45
joinMethod · 0.45
add_session_logMethod · 0.45

Tested by 15

testBasicsMethod · 0.76
testSessionConfigMethod · 0.76
testNoLogdirSucceedsMethod · 0.76
testInitOpMethod · 0.76
testInitFnMethod · 0.76
testLocalInitOpMethod · 0.76
testDefaultGlobalStepMethod · 0.76