我在GCP的Dataproc上构建spark-tensorflow-connector
时遇到了问题。
当其中一个测试失败时,会出现此问题,因为
java.lang.IllegalStateException: LocalPath /tmp/spark-connector-propagate7442350445858279141 already exists. SaveMode: ErrorIfExists
我相信这个问题与LocalWiteSuite.scala脚本的这一部分有关:
"Propagate" should {
"write data locally" in {
// Create a dataframe with 2 partitions
val rdd = spark.sparkContext.parallelize(testRows, numSlices = 2)
val df = spark.createDataFrame(rdd, schema)
// Write the partitions onto the local hard drive. Since it is going to be the
// local file system, the partitions will be written in the same directory of the
// same machine.
// In a distributed setting though, two different machines would each hold a single
// partition.
val localPath = Files.createTempDirectory("spark-connector-propagate").toAbsolutePath.toString
// Delete the directory, the default mode is ErrorIfExists
Files.delete(Paths.get(localPath))
df.write.format("tfrecords")
.option("recordType", "Example")
.option("writeLocality", "local")
.save(localPath)
// Read again this directory, this time using the Hadoop file readers, it should
// return the same data.
// This only works in this test and does not hold in general, because the partitions
// will be written on the workers. Everything runs locally for tests.
val df2 = spark.read.format("tfrecords").option("recordType", "Example")
.load(localPath).sort("id").select("id", "IntegerTypeLabel", "LongTypeLabel",
"FloatTypeLabel", "DoubleTypeLabel", "VectorLabel", "name") // Correct column order.
assert(df2.collect().toSeq === testRows.toSeq)
}
}
}
如果我理解正确,数据集有两个分区,似乎它正在尝试使用相同的文件名在本地写入。
有没有人遇到过这个问题,或者我错过了一个步骤?
请注意,我在GitHub上发布了类似的问题
我有一种感觉,考虑到这是一个非常有价值的软件包,并且许多人已经成功安装了spark-tensorflow-connector,我错过了一步:
我没有将 Tensorflow Hadoop构建为 Maven 依赖项,这在第 3 步中明确定义。
但是,在构建 Tensorflow hadoop 时,我不得不使用一个额外的命令:export _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true
正如 Maven 的 Michael 所建议的那样,surefire 找不到 ForkedBooter 类。
编辑:该问题仍然存在于Dataproc上
溶液:
经过一番研究,我直接加载了最新版本的火花-张量流-连接器,并按照Maven发布的说明安装了它。我不必像Tensorflow Ecosystem中建议的那样安装Tensorflow Hadoop。请注意,我能够在我的 Dataproc 集群上安装 jar 文件。