2016-11-09 90 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解釋。