Orchestrates Spark standalone clusters on HPCs.
Project description
sparkctl
This package implements configuration and orchestration of Spark clusters with standalone cluster managers. This is useful in environments like HPCs where the infrastructure implemented by cloud providers, such as AWS, is not available. It is particularly helpful when users want to deploy Spark but do not have administrative control of the servers.
Example usage
There are two main ways to use this package:
First, allocate compute nodes. For example, with Slurm (1 compute node for the Spark master and 4 compute nodes for Spark workers):
$ salloc -t 01:00:00 -n4 --partition=shared --mem=30G : -N4 --account=<your-account> --mem=240G
- Configure a Spark cluster and run Spark jobs with
spark-submitorpyspark.
$ sparkctl configure
$ sparkctl start
$ spark-submit --master spark://$(hostname):7077 my-job.py
$ sparkctl stop
- Run Spark jobs in a Python script using the
sparkctllibrary to manage the cluster.
from sparkctl import ClusterManager, make_default_spark_config
config = make_default_spark_config()
mgr = ClusterManager(config)
with mgr.managed_cluster() as spark:
df = spark.createDataFrame([(x, x + 1) for x in range(1000)], ["a", "b"])
df.show()
Refer to the user documentation for a description of features and detailed usage instructions.
Project Status
The package is actively maintained and used at the National Laboratory of the Rockies (NLR). The software is primarily geared toward HPCs that use Slurm. It also supports a generic list of servers as long as the servers have access to a shared filesystem and are accessible via SSH without password login.
It would be straightforward to extend the functionality to support other HPC resource managers. Please submit an issue or idea or discussion if you have interest in this package but need that support.
Contributions are welcome.
Development
This project uses uv for environment management. Install the package with its development dependencies:
$ uv sync --extra dev
Lint, format, and type-check the code with ruff and ty:
$ uv run ruff check .
$ uv run ruff format --check .
$ uv run ty check
These checks also run as Git hooks via prek. Install the hooks once and then run them on demand:
$ uv run prek install
$ uv run prek run --all-files
Run the unit tests. These are fast, require no special resources, and are what CI runs:
$ uv run pytest -m "not integration"
The integration tests download a real Spark and Java distribution into tests/data/ and start a
real single-node Spark cluster, so they are slower and require network access and sufficient
memory. They are excluded from CI; run them locally with:
$ uv run pytest -m integration
Run the complete suite (unit and integration tests) with uv run pytest.
License
sparkctl is released under a BSD 3-Clause license.
Software Record
This package is developed under NLR Software Record SWR-25-109.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparkctl-0.5.0.tar.gz.
File metadata
- Download URL: sparkctl-0.5.0.tar.gz
- Upload date:
- Size: 47.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4242362fc87694911a3df5b440e0c19737f5de241734df2fe8db2a602327477
|
|
| MD5 |
7d8c86fa5d2dc42a0130248a13b693ca
|
|
| BLAKE2b-256 |
083d4c1ced55d58a80547af7e997449917ed9bff98640e6d8dfa1cdcc3b1f9e3
|
Provenance
The following attestation bundles were made for sparkctl-0.5.0.tar.gz:
Publisher:
publish_to_pypi.yml on NatLabRockies/sparkctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sparkctl-0.5.0.tar.gz -
Subject digest:
d4242362fc87694911a3df5b440e0c19737f5de241734df2fe8db2a602327477 - Sigstore transparency entry: 1810742638
- Sigstore integration time:
-
Permalink:
NatLabRockies/sparkctl@aa9fbb6c1595aa62785f617cbc4d0c737e1b6e94 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/NatLabRockies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@aa9fbb6c1595aa62785f617cbc4d0c737e1b6e94 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sparkctl-0.5.0-py3-none-any.whl.
File metadata
- Download URL: sparkctl-0.5.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d9c4963835ce482b3bfc94e2dd2529c33cd66b20287e2e6e39525eb1aa4a47f
|
|
| MD5 |
fdd4f65b52840d922bb1b0bf5b411bfb
|
|
| BLAKE2b-256 |
6ebda6ecd44c46f4a692d0420fe30c69c33e548d56fbe871f21b062515aafbbf
|
Provenance
The following attestation bundles were made for sparkctl-0.5.0-py3-none-any.whl:
Publisher:
publish_to_pypi.yml on NatLabRockies/sparkctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sparkctl-0.5.0-py3-none-any.whl -
Subject digest:
5d9c4963835ce482b3bfc94e2dd2529c33cd66b20287e2e6e39525eb1aa4a47f - Sigstore transparency entry: 1810742644
- Sigstore integration time:
-
Permalink:
NatLabRockies/sparkctl@aa9fbb6c1595aa62785f617cbc4d0c737e1b6e94 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/NatLabRockies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yml@aa9fbb6c1595aa62785f617cbc4d0c737e1b6e94 -
Trigger Event:
release
-
Statement type: