Visit the full docs here to see additional examples and the API reference.
Prefect integrations for orchestrating and monitoring apache spark jobs on kubernetes using spark-on-k8s-operator.
prefect-spark-on-k8s-operator
is a collection of Prefect flows enabling orchestration, observation and management of SparkApplication
custom kubernetes resources defined according to spark-on-k8s-operator CRD v1Beta2 API Spec.
Jump to examples.
For more tips on how to use tasks and flows in a Collection, check out Using Collections!
You need to configure the kubernetes credentials as per prefect-kubernetes
documentation.
Install prefect-spark-on-k8s-operator
with pip
:
pip install prefect-spark-on-k8s-operator
Requires an installation of Python 3.7+.
We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
These flows are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.
import asyncio
from prefect_kubernetes.credentials import KubernetesCredentials
from prefect_spark_on_k8s_operator import (
SparkApplication,
run_spark_application, # this is a flow
)
app = SparkApplication.from_yaml_file(
credentials=KubernetesCredentials.load("k8s-creds"),
manifest_path="path/to/spark_application.yaml",
)
if __name__ == "__main__":
# run the flow
asyncio.run(run_spark_application(app))
If you encounter any bugs while using prefect-spark-on-k8s-operator
, feel free to open an issue in the prefect-spark-on-k8s-operator repository.
If you have any questions or issues while using prefect-spark-on-k8s-operator
, you can find help in either the Prefect Discourse forum or the Prefect Slack community.
Feel free to star or watch prefect-spark-on-k8s-operator
for updates too!
If you'd like to help contribute to fix an issue or add a feature to prefect-spark-on-k8s-operator
, please propose changes through a pull request from a fork of the repository.
Here are the steps:
- Fork the repository
- Clone the forked repository
- Install the repository and its dependencies:
pip install -e ".[dev]"
- Make desired changes
- Add tests
- Insert an entry to CHANGELOG.md
- Install
pre-commit
to perform quality checks prior to commit:
pre-commit install
git commit
,git push
, and create a pull request