I'm coding a Spark Streaming Application and I need to save the updated model, so I did as follows:
data.foreachRDD { rdd =>
model = model.update(rdd)
rdd.context.parallelize(model.nodes).saveAsTextFile("target/model")
//model.nodes is an Array[Vector]
}
The problem is that I get this error (since it's a loop):
Output directory file "target/model" already exists
Could someone have an idea to solve this problem ?! thanks