项目作者: gofynd

项目描述 :
A Python framework for managing Dataproc cluster and Scheduling PySpark Jobs over it. Additionally it provides docker based development for debugging PySpark jobs.
高级语言: Python
项目地址: git://github.com/gofynd/ignite.git
创建时间: 2018-04-06T08:26:36Z
项目社区:https://github.com/gofynd/ignite

开源协议:Apache License 2.0

下载


Ignite - Dataproc Cluster Manager for Spark Jobs

Ignite helps you run and manage multiple Spark jobs with variable environment on Google Dataproc. For development phase, the same can be simulated on Docker. User can also configure slack to get cluster status updates.

Features:

  1. Manage Dataproc Cluster
  2. Uploads Spark job code to GCS
  3. Docker based Spark Job execution for development
  4. Spark Job Submission
  5. Slack Integration

Prerequisites:

  1. Create Google Service Account credentials with BigQuery, Dataproc, Storage (gcp_creds.json) with and place inside Ignite root directory. link
  2. Docker installed. link

Quick Start

Project Config

Put appropriate values in settings.py file. Note that this step is not mandatory to run locally.

  1. "project_id": "your-project-id"
  2. "region": "your-gcloud-region"
  3. "zone": "your-gcloud-zone"
  4. "gcs_bucket_name": "your-gcs-bucket-name"
  5. "SLACK_TOKEN": "your-slack-token"
  6. "SLACK_CHANNEL": "channel-name"
  7. "SLACK_USERNAME": "alerting-bot-name"
  8. "slack_enabled": False/True

Also put service account json file on project root directory named “gcp_creds.json”.

Required basic folder structure for spark job

  1. job_sample_job/
  2. ├── __init__.py # Contains config for dataproc cluster, job_cluster.
  3. ├── setup.sh # Contains basic installation scripts for third party tools (including pip install lib).
  4. └── spark_files # Folder- Contains all python files
  5. ├── __init__.py
  6. └── main.py # Main Python file with PySpark code.
  7. 1 directory, 4 files

Add your configuration file (clusterconfig, jobconfig) to `job_sample_job/__init.py`

  1. from job_managers.flow import Flow
  2. project_config = {}
  3. cluster_config = {
  4. "cluster_name": "spark_demo_job",
  5. "numMasterInstances": 1,
  6. "MasterMachineType": "n1-standard-1",
  7. "numWorkerInstances": 3,
  8. "WorkerMachineType": "n1-standard-1",
  9. }
  10. job_config = {
  11. "job_name": "spark_demo_job",
  12. "args": ["gs://fynd-new-bucket/a/README.txt"]
  13. }
  14. spark_demo_job = Flow(project_config, cluster_config, job_config) # Register this flow object to job_managers/executor.py

Currrently there is one demo job registered with this framework.

  1. Spark Demo Job

To register new job, add job into registered_job_flow inside job_managers/executor.py file.

Run

Command to run the job flow-
  1. To run SparkJob on Dataproc cluster - python job_managers/executor.py -j dataproc_sample_job
  2. To run SparkJob locally on Docker environment - python job_managers/executor.py -j dataproc_sample_job -d true