for example, i have a folder:
/
- test.py
- test.yml
and the job is submited to spark cluster with:
gcloud beta dataproc jobs
Yep, Shagun is right.
Basically when you submit a spark job to spark, it does not serialize the file you want processed over to each worker. You will have to do it yourself.
Typically, you will have to put the file in a shared file system like HDFS, S3 (amazon), or any other DFS that can be accessed by all the workers. As soon as you do that, and specify the file destination in your spark script, the spark job will be able to read and process as you wish.
However, having said this, copying the file into the same destination in ALL of you workers and master's file structure also work. Exp, you can create folders like /opt/spark-job/all-files/
in ALL spark nodes, rsync
the file to all of them, and then you can use file in your spark script. But please do not do this. DFS or S3 are way better than this approach.