You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "WeichenXu123 (via GitHub)" <gi...@apache.org> on 2023/05/29 09:12:56 UTC
[GitHub] [spark] WeichenXu123 commented on a diff in pull request #41357: [SPARK-43790][PYSPARK][CONNECT][ML] Add `copyFromLocalToFS` API
WeichenXu123 commented on code in PR #41357:
URL: https://github.com/apache/spark/pull/41357#discussion_r1209105558
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectAddArtifactsHandler.scala:
##########
@@ -89,6 +92,28 @@ class SparkConnectAddArtifactsHandler(val responseObserver: StreamObserver[AddAr
artifactManager.addArtifact(holder, artifact.path, artifact.stagedPath, artifact.fragment)
}
+ protected def uploadStagedArtifactToFS(artifact: StagedArtifact): Unit = {
+ try {
+ val hadoopConf = holder.session.sparkContext.hadoopConfiguration
+ assert(artifact.path.startsWith(forwardToFSPrefix))
+ val destFSPath = new FSPath(
+ Paths.get("/").resolve(artifact.path.subpath(1, artifact.path.getNameCount)).toString
+ )
+ val localPath = artifact.stagedPath
+ val fs = destFSPath.getFileSystem(hadoopConf)
+ fs.copyFromLocalFile(
+ false,
+ true,
+ new FSPath(localPath.toString),
+ destFSPath
+ )
+ } catch {
+ case e: java.io.IOException =>
+ // TODO: report failure in response message
Review Comment:
Discussion: Shall we add a field in ArtifactResponse message for holding failure information here ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org