Skip to content

Commit e75906b

Browse files
committed
Added test setup step to make sure spark-submit is executable.
1 parent 8d2adfc commit e75906b

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

pyrasterframes/src/main/python/tests/__init__.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,27 @@
2323

2424
from pyrasterframes.utils import create_rf_spark_session
2525

26-
2726
import builtins
2827

29-
app_name = 'pyrasterframes test suite'
28+
app_name = 'PyRasterFrames test suite'
29+
30+
# Setuptools/easy_install doesn't properly set the execute bit on the Spark scripts,
31+
# So this preemptively attempts to do it.
32+
def _chmodit():
33+
try:
34+
from importlib.util import find_spec
35+
module_home = find_spec("pyspark").origin
36+
print(module_home)
37+
bin_dir = os.path.join(os.path.dirname(module_home), 'bin')
38+
for filename in os.listdir(bin_dir):
39+
try:
40+
os.chmod(os.path.join(bin_dir, filename), mode=0o555, follow_symlinks=True)
41+
except OSError:
42+
pass
43+
except ImportError:
44+
pass
45+
46+
_chmodit()
3047

3148

3249
def resource_dir():

0 commit comments

Comments
 (0)