Rename shutdown mode field to better fit behavior.

PiperOrigin-RevId: 227581084
This commit is contained in:
Russell Power 2019-01-02 14:22:57 -08:00 committed by TensorFlower Gardener
parent 170ffc3b1a
commit eef699b9f8
2 changed files with 11 additions and 7 deletions

View File

@ -185,7 +185,8 @@ def all_worker_devices(session):
"""Return a list of devices for each worker in the system.""" """Return a list of devices for each worker in the system."""
devices = session.list_devices() devices = session.list_devices()
return [ return [
device.name for device in devices device.name
for device in devices
if ':CPU:' in device.name and 'coordinator' not in device.name if ':CPU:' in device.name and 'coordinator' not in device.name
] ]
@ -255,12 +256,14 @@ class WatchdogManager(threading.Thread):
self._worker_manager.configure( self._worker_manager.configure(
event_pb2.WorkerHeartbeatRequest( event_pb2.WorkerHeartbeatRequest(
watchdog_config=event_pb2.WatchdogConfig( watchdog_config=event_pb2.WatchdogConfig(
timeout_ms=self.shutdown_timeout * 1000,))) timeout_ms=self.shutdown_timeout * 1000,),
shutdown_mode=event_pb2.WAIT_FOR_COORDINATOR))
def configure_and_run(self): def configure_and_run(self):
logging.info('Enabling watchdog timer with %d second timeout ' logging.info(
'and %d second ping interval.', 'Enabling watchdog timer with %d second timeout '
self.shutdown_timeout, self.ping_interval) 'and %d second ping interval.', self.shutdown_timeout,
self.ping_interval)
self._reset_manager() self._reset_manager()
self._running = True self._running = True
self.start() self.start()
@ -269,7 +272,8 @@ class WatchdogManager(threading.Thread):
logging.info('Stopping worker watchdog.') logging.info('Stopping worker watchdog.')
self._worker_manager.configure( self._worker_manager.configure(
event_pb2.WorkerHeartbeatRequest( event_pb2.WorkerHeartbeatRequest(
watchdog_config=event_pb2.WatchdogConfig(timeout_ms=-1,))) watchdog_config=event_pb2.WatchdogConfig(timeout_ms=-1,),
shutdown_mode=event_pb2.NOT_CONFIGURED))
self._running = False self._running = False
self.join() self.join()

View File

@ -95,7 +95,7 @@ enum WorkerHealth {
// signal is received. // signal is received.
enum WorkerShutdownMode { enum WorkerShutdownMode {
DEFAULT = 0; DEFAULT = 0;
SHUTDOWN_IMMEDIATELY = 1; NOT_CONFIGURED = 1;
WAIT_FOR_COORDINATOR = 2; WAIT_FOR_COORDINATOR = 2;
} }