Created
November 11, 2018 19:59
-
-
Save metasim/c4d1225124fcf53cac2d04330ee3f411 to your computer and use it in GitHub Desktop.
Test files for loading a saved model using RasterFrames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with Spark 2.2.1, Python 3.6.4 | |
# Even though we've used `--py-files` on the command line, | |
# unintuitively this still seems necessary to import pyrasterframes | |
SparkContext.addPyFile(spark.sparkContext, 'pyrasterframes.zip') | |
from pyrasterframes import * | |
spark.withRasterFrames() | |
from pyspark.ml import PipelineModel | |
model_load = PipelineModel.load("test_model") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -d test_model ]; then | |
echo "Please unzip test_model.zip here." | |
exit 1 | |
elif [ ! read-model.py ]; then | |
echo "Please save read-model.py script here." | |
exit 2 | |
fi | |
if [ ! -f pyrasterframes.zip ]; then | |
curl --output pyrasterframes.zip https://repo1.maven.org/maven2/org/locationtech/rasterframes/pyrasterframes_2.11/0.7.1/pyrasterframes_2.11-0.7.1-python.zip | |
fi | |
export PYTHONSTARTUP=read-model.py | |
pyspark --master 'local[*]' \ | |
--conf spark.sql.catalogImplementation=in-memory \ | |
--py-files pyrasterframes.zip \ | |
--packages org.locationtech.rasterframes:pyrasterframes_2.11:0.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment