Code Monkey home page Code Monkey logo

databricks_prefect_pipelines's Introduction

Check and Upload to Databricks

Training project to make Prefect managed Databricks pipelines.

CI (GitHub Actions) will run checks, tests and deploy the notebooks to the Databricks server and Prefect Flows to a Prefect Cloud.

Note

This project is still in WIP


Pre-requirements

Following things will be needed:

Setup environment

  1. Setup Azure Databricks and create token for your account.
  2. Create container flows in Azure Storage.
  3. Prepare .env file from an .env_template: cp .env_template .env and fill your secrets.
  4. Launch local Prefect Agent and Prefect CLI with docker compose:
    docker compose up --remove-orphans --force-recreate --pull always
    
    # To cleanup after:
    # docker compose down --rmi all --volumes
    # docker system prune --all --volumes --force  # warning! removes all images and volumes!
  5. Register your storage as a Block into a Prefect Cloud:
    docker exec -it databricks_pipelines-cli-1 python3 src/flows/maintenance/make_block_remote_storage.py
  6. Deploy two existing flows (also will be done by CI):
    docker exec -it databricks_pipelines-cli-1 bash -c "python3 one.py && python3 two.py"
    # or manually:
    docker exec -it databricks_pipelines-cli-1 bash

Now you should be able to trigger Databricks jobs from Prefect Cloud UI.

CI flow

GitHub Actions CI/CD flow defined under .github/workflows:

---
title: CI flow
---
flowchart LR

    subgraph pr[Pull request flow]
    direction TB
        A1[Install Python and dependencies] -->
        B1[Static checks] -->
        C1[Unit tests] -->
        D1[Upload test results]
    end

    subgraph deploy[Merge to master flow]
    direction TB
        A2[Upload notebooks to Databricks] -->
        B2[Build and upload Python lib to Databricks] -->
        C2[Deploy Prefect Flows to Prefect Cloud]
    end

    pr --> deploy
Loading

databricks_prefect_pipelines's People

Contributors

alex7c4 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.