Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 确定/启用spark中的并行性_Scala_Apache Spark_Rdd - Fatal编程技术网

Scala 确定/启用spark中的并行性

Scala 确定/启用spark中的并行性,scala,apache-spark,rdd,Scala,Apache Spark,Rdd,我已经开发了一个scala应用程序,并从中获得了几乎正确的结果。但我不确定我的代码是否利用了spark并行性 我以独立模式运行spark,有两个虚拟工作者,每个虚拟工作者有2个内核和2G内存 下面是应用程序的代码片段: RDD的初始化: for(i <- 0 to limit-1){ data+=new MyClass(dimension_limit) with Serializable } var example_rdd = sc.parallelise(data) 下面是来

我已经开发了一个scala应用程序,并从中获得了几乎正确的结果。但我不确定我的代码是否利用了spark并行性

我以独立模式运行spark,有两个虚拟工作者,每个虚拟工作者有2个内核和2G内存

下面是应用程序的代码片段:

RDD的初始化:

for(i <- 0 to limit-1){
    data+=new MyClass(dimension_limit) with Serializable
}
var example_rdd = sc.parallelise(data)
下面是来自历史记录服务器的作业快照

这是舞台细节:

请帮助我确定我的代码是否并行运行;如果不是,我的实现中会出现什么问题

var temp_rdd: RDD[MyClass] = sc.emptyRDD[MyClass]
temp_rdd = example_rdd

var updated_rdd: RDD[MyClass] = sc.emptyRDD[MyClass]

for(i <- 0 to no_of_iterations-1){
 updated_rdd = temp_rdd.map{ x => updation_function(x)} 
 updated_rdd.count() // to trigger the map
 temp_rdd = updated_rdd
}
def update_function(x: MyClass): MyClass{
  x.property1 = "value"
  .
  .
  .
 //all updations
  return x
}