Skip to main content

Libreria para el Procesamiento Distribuido

Project description

BoxCraft

unittest license last-commit


Este es un proyecto que implementa el modulo BoxCraft para disponer de un sistema para el procesamiento distribuido, basado en la administración de nodos y tareas que aprovecha la flexibilidad de Python y la velocidad de Redis.

Características

  • Sistema de nodos que permite roles de líder y lector para una gestión eficiente.
  • Gestiona y supervisa tareas a través de un sistema dinámico basado en Redis.
  • Sistema para administrar tareas y su estado.

Requisitos

  • Python 3.x
  • Redis instalado y configurado

Instalación

  1. Clona el repositorio:
user@node: git clone https://github.com/Lucho00Cuba/boxcraft.git
user@node: cd boxcraft

Uso

from boxcraft.controller import Box
from time import sleep as time_sleep
from os import environ

def hello(instance=None, action=None):
    print(f"Action: {action} Instance: {instance}")

if __name__ == "__main__":
    try:
        tasks = { 'action': 'delete', 'name': 'poc-*', 'instances': str(["node-01", "node-02", "node-03", "node-04", "node-05"]) }
        ctx = Box()
        print(f"Node: {ctx._node_name} - Role: {ctx._role} - ID: {ctx._id}")
        # publish data
        ctx.publish(tasks)
        # runner
        while True:
            # getting data
            task = ctx.getting()
            if task == None:
                break
            else:
                print(f"Task: {task}")
                # logic to execute the task... 
                ctx.runner(target=hello, kwargs={"instance": task['instances'], "action": task['action']})
                time_sleep(2)
    except Exception as err:
        print(err)

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

boxcraft-0.0.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

boxcraft-0.0.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file boxcraft-0.0.2.tar.gz.

File metadata

  • Download URL: boxcraft-0.0.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for boxcraft-0.0.2.tar.gz
Algorithm Hash digest
SHA256 295000af8a1e503cd9064680272216e676382f95bbfc0a41b8601ea6d5c0b1a4
MD5 cd19306f280e2d27d63040645336ac86
BLAKE2b-256 b7007ad6ef00d422ab1b23efa4d8a72aef9a48746f272e11aa6577693614c1ec

See more details on using hashes here.

File details

Details for the file boxcraft-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: boxcraft-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for boxcraft-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11f38e193e3ed04ad64e49a7c043729fd996cdbc7d151f1fd629a4b78840f115
MD5 ad4f55df23f447ddb98d1cac8639279e
BLAKE2b-256 23fc434d76c758a426befc07f740cc3eb3218adbc49a9f1c71e8aecb92416fd9

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