Skip to main content

SparkFlintCLI facilita a gestão de aplicações Apache Spark em ambientes remotos.

Project description

SparkFlintCLI

PyPI version Downloads PyPI - Downloads Code style: blue License

Descrição

Esse projeto é um CLI desenvolvido com python, typer e ansible.

SparkFlintCLI é uma ferramenta de linha de comando que permite a gestão e a submissão de aplicações Apache Spark em ambientes remotos.

Instalação

Pré-requisitos

  • Python 3.8
  • Typer
  • Ansible
  • Rich

O método mais fácil para instalar é usando pip:

pip install sparkflint

Para instalar do repositório Github:

git clone https://github.com/RibeiroWiliam/sparkflint-cli.git
cd sparkflint-cli
pip install -e .
source <(sparkflint --show-completion zsh)

Para detalhes de uso, verifique sparkflint --help.

Modo de Uso

1. Inicie o sparkflint

Antes de começar a usar sparkflint, é importante definir as principais configurações, como:

  • origin: endereço http da origem dos metadados
  • username: nome de usuário da origem dos metadados
  • password: senha da origem dos metadados

Para isso, use sparkflint init:

sparkflint init
Iniciando configuração...
Origin: http://host-example:8000
Usuário: user_example1
Senha:
✔ URL de Origin válida.
✔ Usuário e senha válidos.


✔ Configuração salva em /Users/UserExample/.sparkflint/config.toml.
Configuração concluída! Você  pode usar os comandos da CLI normalmente.

2. Configurando os hosts

O próximo passo é configurar os hosts de seu ambiente remoto.

Para isso, use sparkflint add host:

sparkflint add host [hostname]
sparkflint add host host-example2.net
sparkflint a h 12.34.56.78

Principais comandos

  • sparkflint add
  • sparkflint init
  • sparkflint kill
  • sparkflint list
  • sparkflint open
  • sparkflint remove
  • sparkflint run
  • sparkflint set
  • sparkflint show
  • sparkflint status
  • sparkflint test

sparkflint add

Use sparkflint add para adicionar hosts.

sparkflint add host [hostname1],[hostname2]    # Adiciona 2 novos hosts

Exemplos:

sparkflint add host host-example2.net
sparkflint a h 12.34.56.78

Opções:

sparkflint add host [hostname]

sparkflint init

Use sparkflint init para inicializar a SparkFlintCLI ou reescrever todas as configs.

sparkflint init     # Inicializa a SparkFlintCLI.
Iniciando configuração...
Origin: http://host-example:8000
Usuário: user_example1
Senha:
✔ URL de Origin válida.
✔ Usuário e senha válidos.


✔ Configuração salva em /Users/UserExample/.sparkflint/config.toml.
Configuração concluída! Você  pode usar os comandos da CLI normalmente.

Options:

sparkflint init --file [filename]     # Inicializa a SparkFlintCLI a partir de um arquivo de config.

sparkflint list

Use sparkflint list para listar aplicações spark, pipelines disponíveis ou dags Airflow

sparkflint list apps     # Lista aplicações YARN em andamento
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━┳━━━━━━┳━━━┳━━━━━━━━┳━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Application-Id             Application-Name                     Application  U  Queu  S  Final-  Pr  Tracking-URL                        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━╇━━━━━━╇━━━╇━━━━━━━━╇━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ application_1741779469365  llap0                                yarn-servic  h  defa  R  UNDEFI  10  N/A                                 │
│ application_1749125299497  sped_processar                       SPARK        a  work  R  UNDEFI  10  http://WN04-SEPLAD.fazenda.net:3555 │
│ application_1749125299497  HIVE-cb4adc8c-41cd-4401-9eb6-d8d318  TEZ          h  defa  R  UNDEFI  0%  http://WN31-SEPLAD.fazenda.net:4153 │
│ application_1749125299497  NFe_etl_PRD                          SPARK        a  work  R  UNDEFI  10  http://WN31-SEPLAD.fazenda.net:3733 │
│ application_1749125299497  NFCe_etl_PRD                         SPARK        a  work  R  UNDEFI  10  http://red04-seplad.fazenda.net:359 │
│ application_1740086204351  Thrift JDBC/ODBC Server              SPARK        h  defa  R  UNDEFI  10  http://MN05-SEPLAD.fazenda.net:4040 │
└───────────────────────────┴─────────────────────────────────────┴─────────────┴───┴──────┴───┴────────┴────┴─────────────────────────────────────
sparkflint list pipelines     # Lista pipelines disponíveis na origin
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Nome            Responsável     ID                                    Criado em                   Atualizado em ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ PIPELINE_01     user_example1   7f3231a6-5c35-466b-9114-5ce861c4fc3c  2025-05-27T17:05:51.533397  -             │
│ PIPELINE_02     user_example2   64546d84-f5e3-41a3-8cba-e5ba6aa88f8f  2025-05-27T17:33:07.875804  -             │
│ PIPELINE_03     user_example3   5b0f007b-225e-4952-88b2-956bb2e0f1ea  2025-05-27T17:34:07.606807  -             │
└────────────────┴────────────────┴──────────────────────────────────────┴────────────────────────────┴───────────────┘
sparkflint list dags     # Lista dags Airflow
# Nao implementado

sparkflint run

Use sparkflint run para executar aplicações spark no ambiente remoto a partir de metadados da origin

sparkflint run [pipeline]   # Executa aplicação
# Não implementado

Options:

sparkflint run [pipeline] --tables [table1],[table2]
sparkflint run [pipeline] --queue [queue]
sparkflint run [pipeline] --name [app-name]

sparkflint logs

Use sparkflint logs para mostrar o log de uma aplicação Spark

sparkflint logs [app-id] # Exibe log de uma aplicação Spark

sparkflint origin

Use sparkflint origin para configurar e acessar a origem de metadados

sparkflint origin set [https-link] # Altera o endereço https da origin
sparkflint origin view [https-link] # Acessa a origin no navegador

Licença de Uso

Contribuicao

Contribuidores

Autocomplete (Zsh ou Bash)

Para ativar o autocompletar dos comandos, adicione ao seu shell:

Zsh

echo 'source <(sparkflint --show-completion zsh)' >> ~/.zshrc

Bash

echo 'source <(sparkflint --show-completion bash)' >> ~/.bashrc

Depois reinicie o terminal.

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

sparkflint-1.0.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

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

sparkflint-1.0.0-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file sparkflint-1.0.0.tar.gz.

File metadata

  • Download URL: sparkflint-1.0.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sparkflint-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6b9abedd11d397c2bb60dce21ec0d8a17df99df5084f44563785f99f9c62b041
MD5 4c4bb4e1d269f816a60f7455336c77b5
BLAKE2b-256 928e2e7c6b155445311c9ee6b79c62f7a1079b4f06e1a2b6141a6d768d905dd5

See more details on using hashes here.

File details

Details for the file sparkflint-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sparkflint-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sparkflint-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 612db1f135a2077254ceaacef1b321cd4fa42c7d8df79c1f628fc06df0367a06
MD5 2af51e628cbbaa6ac0a1bdfe3ec47298
BLAKE2b-256 bd038cbee37734f19d1a33c9f81da66d5987a05cfd8cde6f0942239c58558a8d

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