docstr: *For InputMode.SPARK only*.  Feeds Spark RDD partitions into the TensorFlow worker nodes
  
  It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD.
  
  Since epochs are implemented via ``RDD.union()`` and the entire RDD must generally be processed in full, it is recommended
  to set ``num_epochs`` to closely match your training termination condition (e.g. steps or accuracy).  See ``TFNode.DataFeed``
  for more details.
  
  Args:
    :dataRDD: input data as a Spark RDD.
    :num_epochs: number of times to repeat the dataset during training.
    :feed_timeout: number of seconds after which data feeding times out (600 sec default)
    :qname: *INTERNAL USE*.
docstr_tok: ["*","For","InputMode.SPARK","only","*",".","Feeds","Spark","RDD","partitions","into","the","TensorFlow","worker","nodes","It","is","the","responsibility","of","the","TensorFlow","``","main","''","function","to","interpret","the","rows","of","the","RDD",".","Since","epochs","are","implemented","via","``","RDD.union","(",")","``","and","the","entire","RDD","must","generally","be","processed","in","full",",","it","is","recommended","to","set","``","num_epochs","``","to","closely","match","your","training","termination","condition","(","e.g",".","steps","or","accuracy",")",".","See","``","TFNode.DataFeed","``","for","more","details",".","Args",":",":","dataRDD",":","input","data","as","a","Spark","RDD",".",":","num_epochs",":","number","of","times","to","repeat","the","dataset","during","training",".",":","feed_timeout",":","number","of","seconds","after","which","data","feeding","times","out","(","600","sec","default",")",":","qname",":","*","INTERNAL","USE","*","."]
code: def train(
      self, dataRDD, num_epochs=0, feed_timeout=600, qname="input"
  ):
      """*For InputMode.SPARK only*.  Feeds Spark RDD partitions into the TensorFlow worker nodes
  
      It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD.
  
      Since epochs are implemented via ``RDD.union()`` and the entire RDD must generally be processed in full, it is recommended
      to set ``num_epochs`` to closely match your training termination condition (e.g. steps or accuracy).  See ``TFNode.DataFeed``
      for more details.
  
      Args:
        :dataRDD: input data as a Spark RDD.
        :num_epochs: number of times to repeat the dataset during training.
        :feed_timeout: number of seconds after which data feeding times out (600 sec default)
        :qname: *INTERNAL USE*.
      """
      logger.info("Feeding training data")
      assert (
          self.input_mode == InputMode.SPARK
      ), "TFCluster.train() requires InputMode.SPARK"
      assert qname in self.queues, "Unknown queue: {}".format(qname)
      assert num_epochs >= 0, "num_epochs cannot be negative"
  
      if isinstance(dataRDD, DStream):
          # Spark Streaming
          dataRDD.foreachRDD(
              lambda rdd: rdd.foreachPartition(
                  TFSparkNode.train(
                      self.cluster_info,
                      self.cluster_meta,
                      feed_timeout=feed_timeout,
                      qname=qname,
                  )
              )
          )
      else:
          # Spark RDD
          # if num_epochs unspecified, pick an arbitrarily "large" number for now
          # TODO: calculate via dataRDD.count() / batch_size / max_steps
          if num_epochs == 0:
              num_epochs = 10
          rdds = [dataRDD] * num_epochs
          unionRDD = self.sc.union(rdds)
          unionRDD.foreachPartition(
              TFSparkNode.train(
                  self.cluster_info,
                  self.cluster_meta,
                  feed_timeout=feed_timeout,
                  qname=qname,
              )
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import nested_scopes
  from __future__ import print_function
  import logging
  import os
  import random
  import signal
  import sys
  import threading
  import time
  from pyspark.streaming import DStream
  from .None import reservation
  from .None import TFManager
  from .None import TFSparkNode
label_desc: Use image node_id 1 for calling the TFCluster obj's underlying member method code with example usage: obj.train(dataRDD, num_epochs, feed_timeout, qname) without return types