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

Sea*_*yen 5 apache-spark pyspark

我通过使用将鸡蛋文件添加到pyspark上下文

sc.addPyFile('/path/to/my_file.egg')
Run Code Online (Sandbox Code Playgroud)

但是,如果我做了一些更改并重建了我的egg文件。我无法再次添加。Spark说文件已经存在,我不能再添加了,这是堆栈跟踪

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)
Run Code Online (Sandbox Code Playgroud)

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

谢谢,

mgb*_*her -1

我可以删除(或覆盖)通过 sc.addPyiFiles() 添加的文件的唯一方法是重新启动 pyspark 解释器。