Skip to main content

PySpark batch analytics: Extract, Transform, Stage, and analytical modules (linear regression, correlation, PCA, t-test).

Project description

Batch Analytics

PySpark-based analytics pipeline for ClickHouse data: ExtractTransformStageAnalytics. Designed to run as the main application inside a Spark driver container (invoked by analytics_runners via SparkApplication CRD).

Bundle contents

Only the files required for the batch analytics job runner:

analytics/
├── pyproject.toml
├── requirements.txt          # core + scipy + boto3 + clickhouse-connect (single-file install)
├── requirements-batch.txt  # includes requirements.txt
├── README.md
└── src/
    └── batch_analytics/
        ├── __init__.py
        ├── __main__.py        # python -m batch_analytics
        ├── job_runner.py      # Entry point
        ├── config.py
        ├── extract.py
        ├── transform.py
        ├── log.py
        ├── README.md
        └── analytics/
            ├── __init__.py
            ├── linear_regression.py
            ├── correlation.py
            ├── pca_clustering.py
            └── t_test.py

Install

pip install -e .
# or install every runtime dependency used anywhere in the package, then editable:
pip install -r requirements.txt && pip install -e .
# PyPI wheel pulls numpy automatically (pyspark.ml); extras: ttest, s3, clickhouse, output, full
pip install "batch-analytics[full]"

Run

# Via module
python -m batch_analytics

# Via CLI (after pip install -e .)
batch-analytics

# Full pipeline
batch-analytics

# Analytics only (from staged ClickHouse table)
batch-analytics --from-stage --modules lr corr pca ttest

Configuration

See src/batch_analytics/README.md for environment variables and usage.

Docker image

For Spark on Kubernetes, build an image that includes this package and exposes job_runner.py at the path used by mainApplicationFile (e.g. local:///opt/analytics/job_runner.py).

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

batch_analytics-0.2.3.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

batch_analytics-0.2.3-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file batch_analytics-0.2.3.tar.gz.

File metadata

  • Download URL: batch_analytics-0.2.3.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for batch_analytics-0.2.3.tar.gz
Algorithm Hash digest
SHA256 1ddec45618e0e47b517c2e5e792c1a0801597b36ee0854add6d5d52e431f98f0
MD5 6b15df9ba4a66860451ab532d2130114
BLAKE2b-256 8ab4350bd711207e4f8c542e24ed6055c472f552483d97ef72571780d6cd14c8

See more details on using hashes here.

File details

Details for the file batch_analytics-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for batch_analytics-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6037d14e8641e3b0aae36944c6f7e4af15f6af84591b1191a42731b3f1ec0eb
MD5 692757210878b2afc694cb5bd0e32f20
BLAKE2b-256 e81bcf935de3a0ae359efcea80c9a880e1c491220aab12014056089740f6b740

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page