class_docstr: Implementation of a ClusterResolver which reads the TF_CONFIG EnvVar.
  
  This is an implementation of cluster resolvers when using TF_CONFIG to set
  information about the cluster. The cluster spec returned will be
  initialized from the TF_CONFIG environment variable.
  
  An example to set TF_CONFIG is:
  
    ```Python
    os.environ['TF_CONFIG'] = json.dumps({
      'cluster': {
          'worker': ["localhost:12345", "localhost:23456"]
      },
      'task': {'type': 'worker', 'index': 0}
    })
    ```
  
  However, sometimes the container orchestration framework will set TF_CONFIG
  for you. In this case, you can just create an instance without passing in any
  arguments. You can find an example here to let Kuburnetes set TF_CONFIG for
  you: https://github.com/tensorflow/ecosystem/tree/master/kubernetes. Then you
  can use it with `tf.distribute.Strategy` as:
  
    ```Python
    # `TFConfigClusterResolver` is already the default one in the following
    # strategy.
    strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy(
        cluster_resolver=TFConfigClusterResolver())
    ```
class_docstr_tok: ["Implementation","of","a","ClusterResolver","which","reads","the","TF_CONFIG","EnvVar",".","This","is","an","implementation","of","cluster","resolvers","when","using","TF_CONFIG","to","set","information","about","the","cluster",".","The","cluster","spec","returned","will","be","initialized","from","the","TF_CONFIG","environment","variable",".","An","example","to","set","TF_CONFIG","is",":","``","`","Python","os.environ","[","'TF_CONFIG","'","]","=","json.dumps","(","{","'cluster","'",":","{","'worker","'",":","[","``","localhost:12345","''",",","``","localhost:23456","''","]","}",",","'task","'",":","{","'type","'",":","'worker","'",",","'index","'",":","0","}","}",")","``","`","However",",","sometimes","the","container","orchestration","framework","will","set","TF_CONFIG","for","you",".","In","this","case",",","you","can","just","create","an","instance","without","passing","in","any","arguments",".","You","can","find","an","example","here","to","let","Kuburnetes","set","TF_CONFIG","for","you",":","https",":","\/\/github.com\/tensorflow\/ecosystem\/tree\/master\/kubernetes",".","Then","you","can","use","it","with","`","tf.distribute.Strategy","`","as",":","``","`","Python","#","`","TFConfigClusterResolver","`","is","already","the","default","one","in","the","following","#","strategy",".","strategy","=","tf.distribute.experimental.MultiWorkerMirroredStrategy","(","cluster_resolver=TFConfigClusterResolver","(",")",")","``","`"]
code: def task_type(self):
      if self._task_type is None:
          task_info = _get_value_in_tfconfig(_TASK_KEY, {})
          return str(task_info["type"]) if "type" in task_info else None
      else:
          return str(self._task_type)
  
imports: import json
  import os
  from tensorflow.python.distribute.cluster_resolver.cluster_resolver import ClusterResolver
  from tensorflow.python.training.server_lib import ClusterSpec
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling the TFConfigClusterResolver obj's underlying member method code with example usage: obj.task_type() and returns: unknown, str