Skip to main content

Program for creating data pipelines triggered by file creation events.

Project description

dpypeline

Continuous Integration Test Coverage Code style: black License: MIT

Program for creating data pipelines triggered by file creation events.

Version

0.1.0-beta.1

Pipeline architecture

Celery-based pipeline

Celery-based pipeline architecture

Thread-based pipeline

Thread-based pipeline architecture

Python enviroment setup

Setup the environment using conda (or mamba):

conda create --name <environment_name> --file requirements.txt -c conda-forge python=3.10
conda activate <environment_name>

Alternatively, use virtualenv and pip to setup the environment:

python -m venv <environment_name>
source <envionment_name>/bin/activate
pip install -r requirements.txt

How to use

1. Install the dpypeline package

Install dpypeline using pip:

pip install -i https://test.pypi.org/simple/ dpypeline

2. Start RabbitMQ locally (Optional)

Set up a local instance of RabbitMQ using Docker:

docker pull rabbitmq:3-management
docker run --rm -it -p 15672:15672 -p 5672:5672  rabbitmq:3-management

The rabbitMQ management interface can be access on the url http://localhost:15672

NOTE: If RabbitMQ is run locally, set the BROKER_URL env variable to amqp://guest:guest@localhost. The default username and password are uest.

3. Start a celery worker

Start a celery worker:

python -m celery -A main worker --loglevel=INFO -n ETLPipeline@%h

Alternatively, run the customisable start_celery_worker.sh script:

./start_celery_worker.sh

4. Run the ETL data pipeline

Run one of the examples in the examples directory, e.g.:

python -u examples/example_celery.py

4. Monitor a Celery cluster with Flower (Optional)

Install Flower using pip:

pip install flower

Launch the Flower server at specified port (default is 5555, so --port=5555 can be ommited):

python -m celery -A main flower --port=5555

Alternatively, run Flower via docker:

docker run -p 5555:5555 mher/flower

Access Flower on the url http://localhost:5555/

Unit tests

Run tests using pytest in the main directory:

pip install pytest
pytest

Environment variables

There are a few env variables that need to be set so that the application can run correctly:

  • BROKER_URL: URL of the rabbitMQ broker to connect to.
  • CACHE_DIR: Path to the cache directory.

Filesystems

Credentials to access the object store (.json file)

From inside JASMIN:

{
    "token": <Token generated using the Caringo Portal>,
    "secret": <Secret generated using the Caringo Portal>,
    "endpoint_url": "https://noc-msm-o.s3.jc.rl.ac.uk"
}

External access, from outside JASMIN:

{
    "token": <Token generated using the Caringo portal>,
    "secret": <Secret generated using the Caringo portal>,
    "endpoint_url": "https://noc-msm-o.s3-ext.jc.rl.ac.uk"
}

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

dpypeline-0.1.0b1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

dpypeline-0.1.0b1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file dpypeline-0.1.0b1.tar.gz.

File metadata

  • Download URL: dpypeline-0.1.0b1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for dpypeline-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 0b73f24403e25d9ef5f74c76e8eac2cc3b4b05a75ceb323da9528ba31f829444
MD5 696438d20340daf6457947f3b18f46be
BLAKE2b-256 79492bd67e6e0ad97a4135002edd1feab8b05b163c732f93e09941a33f1763b5

See more details on using hashes here.

File details

Details for the file dpypeline-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: dpypeline-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for dpypeline-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a927321fd15fb0991a8f92471da2f7018394637421b55f5edabd03c1cf4868b
MD5 d86d6b0ba7117c426a5a35e6050219cf
BLAKE2b-256 31cac227d618b7aacb19b1b1cc699baa7b3660ba1b856b2b6882b549c84147ac

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