2016-11-09 95 views
4

我用如何删除或覆盖添加到pyspark作业的文件?

sc.addPyFile('/path/to/my_file.egg') 

但是,如果我做了一些变化,重建我的蛋文件添加一个鸡蛋文件pyspark上下文。我无法再添加它。星火说,该文件已经存在,我不能将其添加again.Here是堆栈跟踪

org.apache.spark.SparkException: File /tmp/spark-ddfc2b0f-2897-4fac-8cf3-d7ccee04700c/userFiles-44152f58-835a-4d9f-acd6-f841468fa2cb/my_file.egg exists and does not match contents of file:///path/to/my_file.egg 
    at org.apache.spark.util.Utils$.copyFile(Utils.scala:489) 
    at org.apache.spark.util.Utils$.doFetchFile(Utils.scala:595) 
    at org.apache.spark.util.Utils$.fetchFile(Utils.scala:394) 
    at org.apache.spark.SparkContext.addFile(SparkContext.scala:1409) 

有没有办法告诉火花来覆盖它?

感谢,

+0

我也遇到过这个问题。它看起来像版本2中的sc.clearFiles()被[删除](https://issues.apache.org/jira/browse/SPARK-17525)。 –

+0

不适用于我。我正在使用Spark 1.6 – Rags

回答

-1

我可以删除(或重写)通过sc.addPyiFiles的手段已添加的文件的唯一方法()是重启pyspark解释。