cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Local file using a Shared Cluster

Kaizen
Valued Contributor

Hi, 

I am saving some files locally on my cluster and moving them after my job. These are log files of my process so I cant directly reference a DBFS location. 

However the dbutils.fs.cp command does not work on the shared cluster. This does however work on a individual cluster. I believe this is related to how the clusters are split amongst users.

File location: "/home/spark-daed4064-233f-446c-b9f2-5b/log.txt''

Copy command: 

 

import os 

#path gets set to /home/spark-daed4064-233f-446c-b9f2-5b/ 
path = os.getcwd() 

new_path = f"{path}/logs.txt" 

# output printed out -> /home/spark-4c17311c-654a-4c71-b551-2e/logs.txt 
print(new_path) 

dbutils.fs.cp(new_path, "dbfs:/databricks/scripts/logs.txt")

 

2 REPLIES 2

Kaizen
Valued Contributor

For reference when doing this on a single user (personal) cluster - the file is store in:

/databricks/driver/logs.txt

 

Which has no issue accessing and copying to dbfs after using the dbutil commands

Kaizen
Valued Contributor

Hi @Retired_mod - thanks for mentioning that. The issue is accessing the local file on the cluster not the dbfs location.

But it is still like you said a cluster config issue:
org.apache.spark.api.python.PythonSecurityException: Path 'file:/home/spark-c989284b-a795-4ca0-858e-84/logs.txt' uses an untrusted filesystem 'com.databricks.backend.daemon.driver.WorkspaceLocalFileSystem'

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group