FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clean up the interface to the distributed runtime from Python · codeplaysoftware/tensorflow@6d83874 · GitHub

Repository navigation

Commit 6d83874

Browse files
authored andcommitted
Clean up the interface to the distributed runtime from Python
This is a breaking change! The following classes have been renamed: tf.GrpcServer -> tf.train.Server tf.ClusterSpec -> tf.train.ClusterSpec tf.ServerDef -> tf.train.ServerDef tf.JobDef -> tf.train.JobDef tf.ClusterDef -> tf.train.ClusterDef The constructor for tf.train.Server is more permissive and now accepts tf.train.ClusterSpec, tf.train.ClusterDef, and dictionary inputs for specifying the cluster part of the server. For consistency, the server library moves from python/client to python/training. Change: 119335624
1 parent a402964 commit 6d83874

13 files changed

Lines changed: 530 additions & 393 deletions

‎tensorflow/python/BUILD‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ py_library(
873873
deps = [
874874
":framework",
875875
":ops",
876-
":server_lib",
877876
":session",
878877
":training_ops",
879878
],
@@ -984,7 +983,6 @@ tf_py_wrap_cc(
984983
swig_includes = [
985984
"client/device_lib.i",
986985
"client/events_writer.i",
987-
"client/server_lib.i",
988986
"client/tf_session.i",
989987
"framework/python_op_gen.i",
990988
"lib/core/py_func.i",
@@ -995,6 +993,7 @@ tf_py_wrap_cc(
995993
"lib/io/py_record_writer.i",
996994
"platform/base.i",
997995
"platform/numpy.i",
996+
"training/server_lib.i",
998997
"util/port.i",
999998
"util/py_checkpoint_reader.i",
1000999
],
@@ -1032,25 +1031,15 @@ py_library(
10321031
],
10331032
)
10341033

1035-
py_library(
1036-
name = "server_lib",
1037-
srcs = ["client/server_lib.py"],
1038-
srcs_version = "PY2AND3",
1039-
deps = [
1040-
":pywrap_tensorflow",
1041-
],
1042-
)
1043-
10441034
py_test(
10451035
name = "server_lib_test",
10461036
size = "small",
1047-
srcs = ["client/server_lib_test.py"],
1037+
srcs = ["training/server_lib_test.py"],
10481038
srcs_version = "PY2AND3",
10491039
deps = [
10501040
":extra_py_tests_deps",
10511041
":framework",
10521042
":framework_test_lib",
1053-
":server_lib",
10541043
":session",
10551044
],
10561045
)
@@ -1261,6 +1250,7 @@ cuda_py_tests(
12611250
["training/*_test.py"],
12621251
exclude = [
12631252
"training/input_test.py",
1253+
"training/server_lib_test.py",
12641254
"training/session_manager_test.py",
12651255
"training/supervisor_test.py",
12661256
],

‎tensorflow/python/__init__.py‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@
127127
# documentation, or remove.
128128
__all__.extend([
129129
'AttrValue',
130-
'ClusterDef',
131-
'ClusterSpec',
132130
'ConfigProto',
133131
'Event',
134132
'GPUOptions',
@@ -137,17 +135,14 @@
137135
'GRAPH_DEF_VERSION_MIN_PRODUCER',
138136
'GraphDef',
139137
'GraphOptions',
140-
'GrpcServer',
141138
'HistogramProto',
142-
'JobDef',
143139
'LogMessage',
144140
'NameAttrList',
145141
'NodeDef',
146142
'OptimizerOptions',
147143
'PaddingFIFOQueue',
148144
'RunOptions',
149145
'RunMetadata',
150-
'ServerDef',
151146
'SessionLog',
152147
'Summary',
153148
'arg_max',

‎tensorflow/python/client/client_lib.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
from __future__ import division
5252
from __future__ import print_function
5353

54-
# NOTE(mrry): Support for `tf.GrpcServer` is currently experimental.
55-
from tensorflow.core.protobuf.tensorflow_server_pb2 import ClusterDef
56-
from tensorflow.core.protobuf.tensorflow_server_pb2 import JobDef
57-
from tensorflow.core.protobuf.tensorflow_server_pb2 import ServerDef
58-
from tensorflow.python.client.server_lib import ClusterSpec
59-
from tensorflow.python.client.server_lib import GrpcServer
60-
6154
from tensorflow.python.client.session import InteractiveSession
6255
from tensorflow.python.client.session import Session
6356

‎tensorflow/python/client/server_lib.py‎

Lines changed: 0 additions & 174 deletions
This file was deleted.

‎tensorflow/python/tensorflow.i‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ limitations under the License.
2929
%include "tensorflow/python/client/events_writer.i"
3030

3131
%include "tensorflow/python/client/tf_session.i"
32-
%include "tensorflow/python/client/server_lib.i"
3332
%include "tensorflow/python/client/device_lib.i"
3433

34+
%include "tensorflow/python/training/server_lib.i"
35+
3536
%include "tensorflow/python/framework/python_op_gen.i"

‎tensorflow/python/training/device_setter.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from __future__ import print_function
1919

2020
from tensorflow.core.framework import graph_pb2
21-
from tensorflow.python.client import server_lib
2221
from tensorflow.python.framework import device as pydev
2322
from tensorflow.python.platform import logging
23+
from tensorflow.python.training import server_lib
2424

2525

2626
class _ReplicaDeviceChooser(object):
@@ -146,9 +146,9 @@ def replica_device_setter(ps_tasks=0, ps_device="/job:ps",
146146
"""
147147
if cluster is not None:
148148
if isinstance(cluster, server_lib.ClusterSpec):
149-
cluster_spec = cluster.as_cluster_spec()
149+
cluster_spec = cluster.as_dict()
150150
else:
151-
cluster_spec = server_lib.ClusterSpec(cluster).as_cluster_spec()
151+
cluster_spec = server_lib.ClusterSpec(cluster).as_dict()
152152
# Get ps_job_name from ps_device by striping "/job:".
153153
ps_job_name = ps_device.lstrip("/job:")
154154
if ps_job_name not in cluster_spec or cluster_spec[ps_job_name] is None:

‎tensorflow/python/training/device_setter_test.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class DeviceSetterTest(tf.test.TestCase):
2424

25-
_cluster_spec = tf.ClusterSpec({
25+
_cluster_spec = tf.train.ClusterSpec({
2626
"ps": ["ps0:2222", "ps1:2222"],
2727
"worker": ["worker0:2222", "worker1:2222", "worker2:2222"]})
2828

@@ -39,7 +39,7 @@ def testPS2TasksWithCluserSpecClass(self):
3939

4040
def testPS2TasksWithClusterSpecDict(self):
4141
with tf.device(tf.train.replica_device_setter(
42-
cluster=self._cluster_spec.as_cluster_spec())):
42+
cluster=self._cluster_spec.as_dict())):
4343
v = tf.Variable([1, 2])
4444
w = tf.Variable([2, 1])
4545
a = v + w
@@ -62,7 +62,7 @@ def testPS2TasksWithClusterDef(self):
6262
self.assertDeviceEqual("/job:worker", a.device)
6363

6464
def testPS2TasksWithDevice(self):
65-
cluster_spec = tf.ClusterSpec({
65+
cluster_spec = tf.train.ClusterSpec({
6666
"sun": ["sun0:2222", "sun1:2222", "sun2:2222"],
6767
"moon": ["moon0:2222", "moon1:2222"]})
6868

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL