worker-automate-hub 0.4.440__py3-none-any.whl → 0.4.442__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,33 +45,6 @@ async def get_new_task(stop_event: threading.Event) -> RpaProcessoEntradaDTO:
45
45
  )
46
46
  return None
47
47
 
48
- async def burnQueue(id_fila: str):
49
- env_config, _ = load_env_config()
50
- try:
51
-
52
- headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
53
-
54
-
55
- async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
56
- async with session.delete(
57
- f"{env_config["API_BASE_URL"]}/fila/burn-queue/{id_fila}",
58
- headers=headers_basic,
59
- ) as response:
60
- if response.status == 200:
61
- logger.info("Fila excluida com sucesso.")
62
- console.print("\nFila excluida com sucesso.\n", style="bold green")
63
- else:
64
- logger.error(f"Erro ao excluir a fila: {response.content}")
65
- console.print(f"Erro ao excluir a fila: {response.content}", style="bold red")
66
-
67
- except Exception as e:
68
- err_msg = f"Erro remover registro da fila: {e}"
69
- logger.error(err_msg)
70
- console.print(
71
- f"{err_msg}\n",
72
- style="bold red",
73
- )
74
- return None
75
48
 
76
49
  async def notify_is_alive(stop_event: threading.Event):
77
50
  env_config, _ = load_env_config()
@@ -348,28 +321,7 @@ async def send_gchat_message(message: str) -> None:
348
321
  style="bold red",
349
322
  )
350
323
  return None
351
-
352
- async def unlock_queue(id: str):
353
- env_config, _ = load_env_config()
354
- try:
355
- headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
356
-
357
324
 
358
- async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
359
- async with session.get(
360
- f"{env_config["API_BASE_URL"]}/fila/unlock-queue/{id}",
361
- headers=headers_basic,
362
- ) as response:
363
- return await response.text()
364
-
365
- except Exception as e:
366
- err_msg = f"Erro ao desbloquear a fila: {e}"
367
- logger.error(err_msg)
368
- console.print(
369
- f"{err_msg}\n",
370
- style="bold red",
371
- )
372
- return None
373
325
 
374
326
 
375
327
  def read_secret(path: str, vault_token: str):
@@ -0,0 +1,58 @@
1
+ from worker_automate_hub.config.settings import load_env_config
2
+ from worker_automate_hub.utils.logger import logger
3
+ from rich.console import Console
4
+
5
+ import aiohttp
6
+
7
+ console = Console()
8
+
9
+
10
+ async def burn_queue(id_fila: str):
11
+ env_config, _ = load_env_config()
12
+ try:
13
+
14
+ headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
15
+
16
+
17
+ async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
18
+ async with session.delete(
19
+ f"{env_config["API_BASE_URL"]}/fila/burn-queue/{id_fila}",
20
+ headers=headers_basic,
21
+ ) as response:
22
+ if response.status == 200:
23
+ logger.info("Fila excluida com sucesso.")
24
+ console.print("\nFila excluida com sucesso.\n", style="bold green")
25
+ else:
26
+ logger.error(f"Erro ao excluir a fila: {response.content}")
27
+ console.print(f"Erro ao excluir a fila: {response.content}", style="bold red")
28
+
29
+ except Exception as e:
30
+ err_msg = f"Erro remover registro da fila: {e}"
31
+ logger.error(err_msg)
32
+ console.print(
33
+ f"{err_msg}\n",
34
+ style="bold red",
35
+ )
36
+ return None
37
+
38
+ async def unlock_queue(id: str):
39
+ env_config, _ = load_env_config()
40
+ try:
41
+ headers_basic = {"Authorization": f"Basic {env_config["API_AUTHORIZATION"]}"}
42
+
43
+
44
+ async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
45
+ async with session.get(
46
+ f"{env_config["API_BASE_URL"]}/fila/unlock-queue/{id}",
47
+ headers=headers_basic,
48
+ ) as response:
49
+ return await response.text()
50
+
51
+ except Exception as e:
52
+ err_msg = f"Erro ao desbloquear a fila: {e}"
53
+ logger.error(err_msg)
54
+ console.print(
55
+ f"{err_msg}\n",
56
+ style="bold red",
57
+ )
58
+ return None
@@ -6,8 +6,8 @@ from rich.console import Console
6
6
  from worker_automate_hub.api.client import (
7
7
  get_processo,
8
8
  send_gchat_message,
9
- unlock_queue,
10
9
  )
10
+ from worker_automate_hub.api.rpa_fila_service import unlock_queue
11
11
  from worker_automate_hub.api.rpa_historico_service import store, update
12
12
  from worker_automate_hub.models.dao.rpa_historico import RpaHistorico
13
13
  from worker_automate_hub.models.dao.rpa_processo import RpaProcesso
@@ -3,11 +3,11 @@ import os
3
3
  import threading
4
4
  from pathlib import Path
5
5
 
6
+ from worker_automate_hub.api.rpa_fila_service import burn_queue, unlock_queue
6
7
  import pyfiglet
7
8
  from rich.console import Console
8
9
 
9
10
  from worker_automate_hub.api.client import (
10
- burnQueue,
11
11
  get_new_task,
12
12
  notify_is_alive,
13
13
  send_gchat_message,
@@ -41,11 +41,12 @@ async def check_and_execute_tasks(stop_event: threading.Event):
41
41
  if task is not None:
42
42
  processo_existe = await is_uuid_in_tasks(task.uuidProcesso)
43
43
  if processo_existe:
44
- await burnQueue(task.uuidFila)
44
+ await burn_queue(task.uuidFila)
45
45
  logger.info(f"Executando a task: {task.nomProcesso}")
46
46
  await perform_task(task)
47
47
  else:
48
- log_message = f"O processo [{task.nomProcesso}] não existe no Worker [{worker_config['NOME_ROBO']}] e não foi removido da fila."
48
+ await unlock_queue(task.uuidFila)
49
+ log_message = f"O processo [{task.nomProcesso}] não existe no Worker [{worker_config['NOME_ROBO']}] e foi devolvido para a fila."
49
50
  console.print(f"\n{log_message}\n", style="yellow")
50
51
  logger.error(log_message)
51
52
  await send_gchat_message(log_message)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worker-automate-hub
3
- Version: 0.4.440
3
+ Version: 0.4.442
4
4
  Summary: Worker Automate HUB é uma aplicação para automatizar rotinas de RPA nos ambientes Argenta.
5
5
  Author: Joel Paim
6
6
  Requires-Python: >=3.12,<4.0
@@ -1,9 +1,10 @@
1
1
  worker_automate_hub/__init__.py,sha256=LV28uQvBfpPIqudGIMJmVB8E941MjXHcu8DMoX5n8AM,25
2
2
  worker_automate_hub/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  worker_automate_hub/api/ahead_service.py,sha256=0tX-i1ACRg3_yOI-_AfFEZ6FNU3L8Zb316n3QUkSwL0,2027
4
- worker_automate_hub/api/client.py,sha256=B75_ekkSDY0H72xGP14DRUMMWL6XtwVEeBmo8RxvnIU,20695
4
+ worker_automate_hub/api/client.py,sha256=qsnyd_B26q199i5fCNWvwLKdQu9bVcS5NjU4L_0xjUw,18791
5
5
  worker_automate_hub/api/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  worker_automate_hub/api/helpers/api_helpers.py,sha256=SkheO2fXexeh-a4shr8Qzsz_kZhuSG0DJ7kbODctRbM,3696
7
+ worker_automate_hub/api/rpa_fila_service.py,sha256=DxBEghdoF2DZQDnkThEEQDkoak4yVRM9kooV1fm0syg,2102
7
8
  worker_automate_hub/api/rpa_historico_service.py,sha256=WhTMVW-uNlJO3YZakhx63xlsw3_XDeWnSD-3MVEzzdk,4763
8
9
  worker_automate_hub/cli.py,sha256=JB45pjPJ8_E-4xw0OjqDMcAw-tpDV0mjmvwJRTnTzY0,6862
9
10
  worker_automate_hub/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -58,7 +59,7 @@ worker_automate_hub/tasks/jobs/playground.py,sha256=bdnXv3C7WLQUxt4edGZDfAbRJJ2-
58
59
  worker_automate_hub/tasks/jobs/sped_fiscal.py,sha256=_byvD7i_N3pgPjQd1lc0XNKCFONIPbmvX3_jq5AnbKY,26707
59
60
  worker_automate_hub/tasks/jobs/transferencias.py,sha256=zwCbVTwX15SCeLtvYgAyENeUSIuETx4Z9Cysr1Es8Jo,38013
60
61
  worker_automate_hub/tasks/task_definitions.py,sha256=2Jp1H4_qJZqqGyaP6MA87KLt4QNrtWBYWbXu-2gymFo,4459
61
- worker_automate_hub/tasks/task_executor.py,sha256=eXFgWbcM8aMPwENvNix8KyFv7BqvIwhXUDkBSI1ul7M,8873
62
+ worker_automate_hub/tasks/task_executor.py,sha256=_PredamXAISIHpw7R-S0VgLbaO8lyG_z2BdUxtOrcg8,8921
62
63
  worker_automate_hub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
64
  worker_automate_hub/utils/env.py,sha256=TacQjGRO7PUNpttrhTAc5Gnegaiysl2Knsv1P8qfkfs,57
64
65
  worker_automate_hub/utils/get_creds_gworkspace.py,sha256=ZJ0IIEjM4IXIV9rwfbOZ1V1wiaMoJAGZeSy0D37sYdU,2212
@@ -67,8 +68,8 @@ worker_automate_hub/utils/toast.py,sha256=xPHc5r5uOxB_cZlCzm13Kt2qSKLLFZALncU6Qg
67
68
  worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbVlwDl49Y,7972
68
69
  worker_automate_hub/utils/util.py,sha256=6GFMSMk8DOE_6Y_xmYQBczyN7bxcGRrH2q634Lb2Um0,121847
69
70
  worker_automate_hub/utils/utils_nfe_entrada.py,sha256=7ju688sD52y30taGSm5rPMGdQyByUUwveLeKV4ImEiE,28401
70
- worker_automate_hub/worker.py,sha256=KDBU3L2kVobndrnN5coRZFTwVmBLKmPJjRv20sCo5Hc,4697
71
- worker_automate_hub-0.4.440.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
72
- worker_automate_hub-0.4.440.dist-info/METADATA,sha256=THkDGdmgI_Vu4f1XF-r1K9GA6Vql7-nCMh2y1F32Vbs,2895
73
- worker_automate_hub-0.4.440.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
74
- worker_automate_hub-0.4.440.dist-info/RECORD,,
71
+ worker_automate_hub/worker.py,sha256=tftQpX8liC-_0_bOUf1YYzXSCvloMQBvjmQ6lzfEE-c,4816
72
+ worker_automate_hub-0.4.442.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
73
+ worker_automate_hub-0.4.442.dist-info/METADATA,sha256=pcgai57dIRzyAYKFqwUhqD1umATgIRJNHJ6Y8AI8z_A,2895
74
+ worker_automate_hub-0.4.442.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
75
+ worker_automate_hub-0.4.442.dist-info/RECORD,,