## BoxCraft
<p align="left">
<a href="#">
<img src="https://img.shields.io/github/actions/workflow/status/Lucho00Cuba/boxcraft/tests.yaml" alt="unittest"/>
</a>
<a href="#">
<img src="https://img.shields.io/github/license/Lucho00Cuba/boxcraft" alt="license"/>
</a>
<a href="#">
<img src="https://img.shields.io/github/last-commit/Lucho00Cuba/boxcraft" alt="last-commit"/>
</a>
</p>
<hr>
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:
```bash
user@node: git clone https://github.com/Lucho00Cuba/boxcraft.git
user@node: cd boxcraft
```
## Uso
```python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Lucho00Cuba/boxcraft",
"name": "boxcraft",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "python box",
"author": "JustMe",
"author_email": "lomv0209@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b7/00/7ad6ef00d422ab1b23efa4d8a72aef9a48746f272e11aa6577693614c1ec/boxcraft-0.0.2.tar.gz",
"platform": null,
"description": "## BoxCraft\n<p align=\"left\">\n <a href=\"#\">\n <img src=\"https://img.shields.io/github/actions/workflow/status/Lucho00Cuba/boxcraft/tests.yaml\" alt=\"unittest\"/>\n </a>\n <a href=\"#\">\n <img src=\"https://img.shields.io/github/license/Lucho00Cuba/boxcraft\" alt=\"license\"/>\n </a>\n <a href=\"#\">\n <img src=\"https://img.shields.io/github/last-commit/Lucho00Cuba/boxcraft\" alt=\"last-commit\"/>\n </a>\n</p>\n<hr>\n\nEste es un proyecto que implementa el modulo `BoxCraft` para disponer de un sistema para el procesamiento distribuido, basado en la administraci\u00f3n de nodos y tareas que aprovecha la flexibilidad de Python y la velocidad de Redis.\n\n## Caracter\u00edsticas\n- Sistema de nodos que permite roles de l\u00edder y lector para una gesti\u00f3n eficiente.\n- Gestiona y supervisa tareas a trav\u00e9s de un sistema din\u00e1mico basado en Redis.\n- Sistema para administrar tareas y su estado.\n\n## Requisitos\n\n- Python 3.x\n- `Redis` instalado y configurado\n\n## Instalaci\u00f3n\n\n1. Clona el repositorio:\n\n```bash\nuser@node: git clone https://github.com/Lucho00Cuba/boxcraft.git\nuser@node: cd boxcraft\n```\n\n## Uso\n```python\nfrom boxcraft.controller import Box\nfrom time import sleep as time_sleep\nfrom os import environ\n\ndef hello(instance=None, action=None):\n print(f\"Action: {action} Instance: {instance}\")\n\nif __name__ == \"__main__\":\n try:\n tasks = { 'action': 'delete', 'name': 'poc-*', 'instances': str([\"node-01\", \"node-02\", \"node-03\", \"node-04\", \"node-05\"]) }\n ctx = Box()\n print(f\"Node: {ctx._node_name} - Role: {ctx._role} - ID: {ctx._id}\")\n # publish data\n ctx.publish(tasks)\n # runner\n while True:\n # getting data\n task = ctx.getting()\n if task == None:\n break\n else:\n print(f\"Task: {task}\")\n # logic to execute the task... \n ctx.runner(target=hello, kwargs={\"instance\": task['instances'], \"action\": task['action']})\n time_sleep(2)\n except Exception as err:\n print(err)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Libreria para el Procesamiento Distribuido",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/Lucho00Cuba/boxcraft"
},
"split_keywords": [
"python",
"box"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "23fc434d76c758a426befc07f740cc3eb3218adbc49a9f1c71e8aecb92416fd9",
"md5": "ad4f55df23f447ddb98d1cac8639279e",
"sha256": "11f38e193e3ed04ad64e49a7c043729fd996cdbc7d151f1fd629a4b78840f115"
},
"downloads": -1,
"filename": "boxcraft-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ad4f55df23f447ddb98d1cac8639279e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7602,
"upload_time": "2023-08-16T15:18:07",
"upload_time_iso_8601": "2023-08-16T15:18:07.064534Z",
"url": "https://files.pythonhosted.org/packages/23/fc/434d76c758a426befc07f740cc3eb3218adbc49a9f1c71e8aecb92416fd9/boxcraft-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b7007ad6ef00d422ab1b23efa4d8a72aef9a48746f272e11aa6577693614c1ec",
"md5": "cd19306f280e2d27d63040645336ac86",
"sha256": "295000af8a1e503cd9064680272216e676382f95bbfc0a41b8601ea6d5c0b1a4"
},
"downloads": -1,
"filename": "boxcraft-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "cd19306f280e2d27d63040645336ac86",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7024,
"upload_time": "2023-08-16T15:18:08",
"upload_time_iso_8601": "2023-08-16T15:18:08.374174Z",
"url": "https://files.pythonhosted.org/packages/b7/00/7ad6ef00d422ab1b23efa4d8a72aef9a48746f272e11aa6577693614c1ec/boxcraft-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-16 15:18:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Lucho00Cuba",
"github_project": "boxcraft",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "boxcraft"
}