code: def runJob(self, rdd, partitionFunc, partitions=None, allowLocal=False):
          
          if partitions is None:
              partitions = range(rdd._jrdd.partitions().size())
  
          # Implementation note: This is implemented as a mapPartitions followed
          # by runJob() in order to avoid having to pass a Python lambda into
          # SparkContext#runJob.
          mappedRDD = rdd.mapPartitions(partitionFunc)
          sock_info = self._jvm.PythonRDD.runJob(self._jsc.sc(), mappedRDD._jrdd, partitions)
          return list(_load_from_socket(sock_info, mappedRDD._jrdd_deserializer))
docs: Executes the given partitionFunc on the specified set of partitions,
          returning the result as an array of elements.
  
          If 'partitions' is not specified, this will run over all partitions.
  
          >>> myRDD = sc.parallelize(range(6), 3)
          >>> sc.runJob(myRDD, lambda part: [x * x for x in part])
          [0, 1, 4, 9, 16, 25]
  
          >>> myRDD = sc.parallelize(range(6), 3)
          >>> sc.runJob(myRDD, lambda part: [x * x for x in part], [0, 2], True)
          [0, 1, 16, 25]