def on_worker(port, worker_start): logging.info('worker starting server on {}'.format(port)) profiler.start_server(port) _, steps, train_ds, model = _model_setup() worker_start.set() while True: model.fit(x=train_ds, epochs=2, steps_per_epoch=steps) if self.profile_done: break
def testTrace_ProfileIdleServer(self): test_port = portpicker.pick_unused_port() profiler.start_server(test_port) # Test the profilers are successfully started and connected to profiler # service on the worker. Since there is no op running, it is expected to # return UnavailableError with no trace events collected string. with self.assertRaises(errors.UnavailableError) as error: profiler_client.trace( 'localhost:' + str(test_port), self.get_temp_dir(), duration_ms=10) self.assertStartsWith(str(error.exception), 'No trace event was collected')
def on_worker(port): logging.info('worker starting server on {}'.format(port)) profiler.start_server(port) _, steps, train_ds, model = _model_setup() model.fit(x=train_ds, epochs=2, steps_per_epoch=steps)