Spark Py Submit
A python library that can submit spark job to spark yarn cluster using rest API
Getting Started:
Use the library
# Import the SparkJobHandler
from spark_job_handler import SparkJobHandler
...
logger = logging.getLogger('TestLocalJobSubmit')
# Create a spark JOB
# jobName: name of the Spark Job
# jar: location of the Jar (local/hdfs)
# run_class: entry class of the appliaction
# hadoop_rm: hadoop resource manager host ip
# hadoop_web_hdfs: hadoop web hdfs ip
# hadoop_nn: hadoop name node ip (Normally same as of web_hdfs)
# env_type: env type is CDH or HDP
# local_jar: flag to define if a jar is local (Local jar gets uploaded to hdfs)
# spark_properties: custom properties that need to be set
sparkJob = SparkJobHandler(logger=logger, job_name="test_local_job_submit",
jar="./simple-project/target/scala-2.10/simple-project_2.10-1.0.jar",
run_class="IrisApp", hadoop_rm='rma', hadoop_web_hdfs='nn', hadoop_nn='nn',
env_type="CDH", local_jar=True, spark_properties=None)
trackingUrl = sparkJob.run()
print "Job Tracking URL: %s" % trackingUrl
Build the simple-project
$ cd simple-project
$ sbt package;cd ..
The above steps will create the target jar as: ./simple-project/target/scala-2.10/simple-project_2.10-1.0.jar
Update the nodes Ip in test:
load the data and make it available to HDFS:
$ wget https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
upload data to the HDFS:
$ python upload_to_hdfs.py <name_nodei_ip> iris.data /tmp/iris.data
Run the test cases:
Make the simple-project jar available in HDFS to test remote jar:
$ python upload_to_hdfs.py <name_nodei_ip> simple-project/target/scala-2.10/simple-project_2.10-1.0.jar /tmp/test_data/simple-project_2.10-1.0.jar
Run the test:
$ python test_spark_job_handler.py
Utility:
upload_to_hdfs.py: upload local file to hdfs file system
Notes:
Metadata
Release files for spark-yarn-submit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spark_yarn_submit-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for spark_yarn_submit-1.0.0-py2.py3-none-any.whl |
Release files / spark_yarn_submit-1.0.0-py2.py3-none-any.whl
| Download URL | spark_yarn_submit-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b757b2d7b3a47997dc803609eb40df3ae93026618c83febdf3e66ada3bd15fcd
|
|
BLAKE2b-256 checksum How to use checksums |
d25df8b9747498ebbcf36c82e6d17f0c8e3964e2a5eb238588c077360e54c8f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for spark-yarn-submit 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.