blob: de1334f046c6b96819a071482f1d6b376f7fbb04 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
|