diff options
author | Josh Rosen <joshrosen@eecs.berkeley.edu> | 2013-01-21 16:42:24 -0800 |
---|---|---|
committer | Josh Rosen <joshrosen@eecs.berkeley.edu> | 2013-01-21 17:34:17 -0800 |
commit | ef711902c1f42db14c8ddd524195f0a9efb56e65 (patch) | |
tree | e770a7439d3983c13346cbd81aa1eeeef23e2571 /python/pyspark/files.py | |
parent | 506077c9938cd411842fe42404aa6b74b45b23a1 (diff) | |
download | spark-ef711902c1f42db14c8ddd524195f0a9efb56e65.tar.gz spark-ef711902c1f42db14c8ddd524195f0a9efb56e65.tar.bz2 spark-ef711902c1f42db14c8ddd524195f0a9efb56e65.zip |
Don't download files to master's working directory.
This should avoid exceptions caused by existing
files with different contents.
I also removed some unused code.
Diffstat (limited to 'python/pyspark/files.py')
-rw-r--r-- | python/pyspark/files.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/python/pyspark/files.py b/python/pyspark/files.py new file mode 100644 index 0000000000..de1334f046 --- /dev/null +++ b/python/pyspark/files.py @@ -0,0 +1,24 @@ +import os + + +class SparkFiles(object): + """ + Resolves paths to files added through + L{addFile()<pyspark.context.SparkContext.addFile>}. + + SparkFiles contains only classmethods; users should not create SparkFiles + instances. + """ + + _root_directory = None + + def __init__(self): + raise NotImplementedError("Do not construct SparkFiles objects") + + @classmethod + def get(cls, filename): + """ + Get the absolute path of a file added through C{addFile()}. + """ + path = os.path.join(SparkFiles._root_directory, filename) + return os.path.abspath(path) |