Skip to main content

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

Project description

SparkFlintCLI

PyPI version PyPI - Downloads 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 .

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.1.tar.gz (23.4 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.1-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparkflint-1.0.1.tar.gz
  • Upload date:
  • Size: 23.4 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.1.tar.gz
Algorithm Hash digest
SHA256 ef8f53a132a64de9556a12884c18f5fadf8e8b04b9d2919cd53d073d78b445a3
MD5 a1266a95bc8a496b60249d79f1b9a6d1
BLAKE2b-256 c6925e7e4a12cd815cbfb4a7b8658f93421ce92fc649194b689b169c0d45b452

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sparkflint-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 38.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d2566386d5c6afbd5619911bc7ee29a6f8b17a8c1b1cbe29b8809172b4c96e3
MD5 80c60d4b32142bee2202a70774d4d162
BLAKE2b-256 bae4b3402884cc58a7e2233bc98e984f522071392e4d524f0788e2ac7fad2927

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