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

Method __init__

tensorflow/python/training/server_lib.py:111–152  ·  view source on GitHub ↗

Creates a new server with the given definition. The `job_name`, `task_index`, and `protocol` arguments are optional, and override any information provided in `server_or_cluster_def`. Args: server_or_cluster_def: A `tf.train.ServerDef` or `tf.train.ClusterDef` protocol buf

(self,
               server_or_cluster_def,
               job_name=None,
               task_index=None,
               protocol=None,
               config=None,
               start=True)

Source from the content-addressed store, hash-verified

109 """
110
111 def __init__(self,
112 server_or_cluster_def,
113 job_name=None,
114 task_index=None,
115 protocol=None,
116 config=None,
117 start=True):
118 """Creates a new server with the given definition.
119
120 The `job_name`, `task_index`, and `protocol` arguments are optional, and
121 override any information provided in `server_or_cluster_def`.
122
123 Args:
124 server_or_cluster_def: A `tf.train.ServerDef` or `tf.train.ClusterDef`
125 protocol buffer, or a `tf.train.ClusterSpec` object, describing the
126 server to be created and/or the cluster of which it is a member.
127 job_name: (Optional.) Specifies the name of the job of which the server is
128 a member. Defaults to the value in `server_or_cluster_def`, if
129 specified.
130 task_index: (Optional.) Specifies the task index of the server in its job.
131 Defaults to the value in `server_or_cluster_def`, if specified.
132 Otherwise defaults to 0 if the server's job has only one task.
133 protocol: (Optional.) Specifies the protocol to be used by the server.
134 Acceptable values include `"grpc", "grpc+verbs"`. Defaults to the value
135 in `server_or_cluster_def`, if specified. Otherwise defaults to
136 `"grpc"`.
137 config: (Options.) A `tf.compat.v1.ConfigProto` that specifies default
138 configuration options for all sessions that run on this server.
139 start: (Optional.) Boolean, indicating whether to start the server after
140 creating it. Defaults to `True`.
141
142 Raises:
143 tf.errors.OpError: Or one of its subclasses if an error occurs while
144 creating the TensorFlow server.
145 """
146 os.environ['TASK_INDEX'] = str(task_index)
147
148 self._server_def = _make_server_def(server_or_cluster_def, job_name,
149 task_index, protocol, config)
150 self._server = c_api.TF_NewServer(self._server_def.SerializeToString())
151 if start:
152 self.start()
153
154 def __del__(self):
155 try:

Callers

nothing calls this directly

Calls 3

startMethod · 0.95
_make_server_defFunction · 0.85
SerializeToStringMethod · 0.45

Tested by

no test coverage detected