from tensorflow.python.training import server_lib

      s.bind(("", 0))
      port = s.getsockname()[1]
      s.close()
      return port

    port1 = get_open_port()
    port2 = get_open_port()
    cs = server_lib.ClusterSpec({
        "worker": ["localhost:%s" % port1],
        "ps": ["localhost:%s" % port2]
    })

    worker = server_lib.Server(cs, job_name="worker", start=True)
    ps = server_lib.Server(cs, job_name="ps", start=True)
