berryworld 1.0.0.199233__py3-none-any.whl → 1.0.0.199316__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.
- berryworld/__init__.py +1 -1
- berryworld/python_logs.py +22 -27
- {berryworld-1.0.0.199233.dist-info → berryworld-1.0.0.199316.dist-info}/METADATA +1 -1
- {berryworld-1.0.0.199233.dist-info → berryworld-1.0.0.199316.dist-info}/RECORD +8 -8
- /berryworld/{sql_connenction.py → sql_connection.py} +0 -0
- {berryworld-1.0.0.199233.dist-info → berryworld-1.0.0.199316.dist-info}/WHEEL +0 -0
- {berryworld-1.0.0.199233.dist-info → berryworld-1.0.0.199316.dist-info}/licenses/LICENSE +0 -0
- {berryworld-1.0.0.199233.dist-info → berryworld-1.0.0.199316.dist-info}/top_level.txt +0 -0
berryworld/__init__.py
CHANGED
|
@@ -24,4 +24,4 @@ from .teams_logging import TeamsLogging
|
|
|
24
24
|
from .vivantio_logging import VivantioLogging
|
|
25
25
|
from .snowflake_conn import SnowflakeConn
|
|
26
26
|
from .logging import PythonLogs
|
|
27
|
-
from .
|
|
27
|
+
from .sql_connection import SQLConnection, SQLConnectionPool, SQLPoolEngine
|
berryworld/python_logs.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import time
|
|
2
2
|
import math
|
|
3
3
|
import datetime
|
|
4
|
-
from uuid import uuid4
|
|
5
4
|
import pandas as pd
|
|
5
|
+
from uuid import uuid4
|
|
6
6
|
from threading import Thread
|
|
7
7
|
|
|
8
8
|
|
|
@@ -29,18 +29,20 @@ class ErrorLogs:
|
|
|
29
29
|
self.guid = str(uuid4())
|
|
30
30
|
self.pipeline = pipeline
|
|
31
31
|
self.failure_type = []
|
|
32
|
+
self.completed = False
|
|
32
33
|
Thread(target=self.start_threading).start()
|
|
33
34
|
|
|
34
35
|
def start_threading(self):
|
|
35
36
|
""" Start a threading to update on failure if the script breaks or the pipeline gets blocked
|
|
36
37
|
"""
|
|
37
|
-
|
|
38
|
+
step = 10
|
|
39
|
+
time_range = math.ceil(self.timeout / step)
|
|
38
40
|
for times in range(time_range):
|
|
39
|
-
time.sleep(
|
|
40
|
-
if
|
|
41
|
+
time.sleep(step)
|
|
42
|
+
if self.completed is True:
|
|
41
43
|
break
|
|
42
44
|
|
|
43
|
-
if
|
|
45
|
+
if self.completed is False:
|
|
44
46
|
elapsed_time = str(datetime.timedelta(seconds=round(self.timeout)))[2:]
|
|
45
47
|
self.on_failure(error_message=f'The pipeline failed to succeed after running '
|
|
46
48
|
f'for {elapsed_time} minutes')
|
|
@@ -49,14 +51,14 @@ class ErrorLogs:
|
|
|
49
51
|
""" Update log on success
|
|
50
52
|
:param pipeline: Pipeline name being run. It must identify the process being executed uniquely
|
|
51
53
|
"""
|
|
52
|
-
if
|
|
54
|
+
if self.completed is False:
|
|
53
55
|
if pipeline is not None:
|
|
54
56
|
self.pipeline = pipeline
|
|
55
57
|
successful_columns = {'Successful': 1, 'Resolved': 1, 'Pipeline': self.pipeline, 'GuidKey': self.guid,
|
|
56
58
|
'FinishedDate': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")}
|
|
57
59
|
self.log_df = self.log_df.assign(**successful_columns)
|
|
58
60
|
self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
|
|
59
|
-
self.
|
|
61
|
+
self.completed = True
|
|
60
62
|
|
|
61
63
|
Thread(target=self.trigger_merge_stored_procedure).start()
|
|
62
64
|
|
|
@@ -68,27 +70,20 @@ class ErrorLogs:
|
|
|
68
70
|
:param critical: Indicate whether it should avoid sending successful logs
|
|
69
71
|
:param proposed_solution: Proposed solution to the error message
|
|
70
72
|
"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
if pipeline is not None:
|
|
74
|
+
self.pipeline = pipeline
|
|
75
|
+
unsuccessful_columns = {'Successful': 0, 'Section': section, 'Pipeline': self.pipeline,
|
|
76
|
+
'GuidKey': self.guid, 'Critical': 1 if critical is True else 0,
|
|
77
|
+
'FinishedDate': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
|
|
78
|
+
'ErrorMessage': str(error_message).replace("'", '"')}
|
|
79
|
+
self.log_df = self.log_df.assign(**unsuccessful_columns)
|
|
80
|
+
if proposed_solution is not None:
|
|
81
|
+
self.log_df = self.log_df.assign(**{'ProposedSolution': proposed_solution})
|
|
82
|
+
self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
|
|
83
|
+
self.completed = True
|
|
84
|
+
self.failure_type.append(self.completed)
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
if pipeline is not None:
|
|
80
|
-
self.pipeline = pipeline
|
|
81
|
-
unsuccessful_columns = {'Successful': 0, 'Section': section, 'Pipeline': self.pipeline,
|
|
82
|
-
'GuidKey': self.guid, 'Critical': 1 if critical is True else 0,
|
|
83
|
-
'FinishedDate': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
|
|
84
|
-
'ErrorMessage': str(error_message).replace("'", '"')}
|
|
85
|
-
self.log_df = self.log_df.assign(**unsuccessful_columns)
|
|
86
|
-
if proposed_solution is not None:
|
|
87
|
-
self.log_df = self.log_df.assign(**{'ProposedSolution': proposed_solution})
|
|
88
|
-
self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
|
|
89
|
-
self.failure_type.append(critical)
|
|
90
|
-
|
|
91
|
-
Thread(target=self.trigger_merge_stored_procedure).start()
|
|
86
|
+
Thread(target=self.trigger_merge_stored_procedure).start()
|
|
92
87
|
|
|
93
88
|
def trigger_merge_stored_procedure(self):
|
|
94
89
|
""" Trigger the merge stored procedure to aggregate logs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
berryworld/__init__.py,sha256=
|
|
1
|
+
berryworld/__init__.py,sha256=yqZzic5XpvvMEd_JkQHSYN-a0rV2XbW76C_4NTV3Fck,1174
|
|
2
2
|
berryworld/aks_logs.py,sha256=Gb2_cokiZbEX01Yoptd0MxpDociaug-GrXdwliyxFBo,2293
|
|
3
3
|
berryworld/allocation_solver.py,sha256=asFtaCAze6-eHUGWXA0kAp67UBS-Upj1KKdrVLj_ttQ,8513
|
|
4
4
|
berryworld/app_logs.py,sha256=MKzKPYd3JuPfOQNAapIgaeZeFHw1z_w2mbn9I6QCADE,4180
|
|
@@ -16,23 +16,23 @@ berryworld/microsoft_teams.py,sha256=8uPo0yku-euBj2VdzBoZCeX3IcsCCOqISLqaVZUVxfA
|
|
|
16
16
|
berryworld/persistent_storage.py,sha256=L15kLyzN42T6UB1WAg8rFXJq3Mdb1M8Sw4P5YQaUN84,8711
|
|
17
17
|
berryworld/pickle_management.py,sha256=5o6UuXBpTj23Jgpz6sj9V-vdcdWBK1xMEckWxT-Whj4,2436
|
|
18
18
|
berryworld/power_automate.py,sha256=V86QEGG9H36DrDvod9Q6yp8OUu307hfYcXJhw06pYrA,27912
|
|
19
|
-
berryworld/python_logs.py,sha256=
|
|
19
|
+
berryworld/python_logs.py,sha256=zmuj5Ztcj03qiqqrzquikPCCl2KuziYiXXQVcNPEpO8,5567
|
|
20
20
|
berryworld/sharepoint_con.py,sha256=nmyZJIcaAKJ6Y-ti4gQbvzA_rRbrMGIxTDXe4eP-tiI,44950
|
|
21
21
|
berryworld/snowflake_conn.py,sha256=L0ePgTKa3tvaxj88BZmsjS6cFp3ZU3rytw7S2jkuA-U,3161
|
|
22
22
|
berryworld/sql_conn.py,sha256=6kUR3oLXweakz2IBc4zI1ZMqRoN8K6nbQneHhenM-7I,47668
|
|
23
|
-
berryworld/
|
|
23
|
+
berryworld/sql_connection.py,sha256=IJAOsQ7p0tMFEEucazmmkS3lNonf_YFWftyZ_kGPHj8,104150
|
|
24
24
|
berryworld/teams_logging.py,sha256=8NwXyWr4fLj7W6GzAm2nRQCGFDxibQpAHDHHD24FrP8,6997
|
|
25
25
|
berryworld/transportation_solver.py,sha256=tNc1JJk71azIBccdWVHbqcvXWhalOdKffv6HmBD6tG0,5014
|
|
26
26
|
berryworld/verify_keys.py,sha256=X7VUHqYDklWPDO0bGVHIOXeLq5Qi4fZRZbHYw5x7UnA,4356
|
|
27
27
|
berryworld/vivantio.py,sha256=QfZo0UKqkzVRg_LyiwivNd3aEup4TH57x4KxLZkCJwc,10627
|
|
28
28
|
berryworld/vivantio_logging.py,sha256=ciy7gA4u3FrgUIpEBnMgocbNPp6jcu9TPoy-kLcrTZU,5736
|
|
29
29
|
berryworld/xml_parser.py,sha256=HWD71NaTN3DaIOGT6Wzxs4CEsroFhGQwe9iPLIL80Co,957
|
|
30
|
-
berryworld-1.0.0.
|
|
30
|
+
berryworld-1.0.0.199316.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
|
|
31
31
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
tests/test_allocation_config.py,sha256=e12l6fE9U57eSPS35g6ekJ_hol7-RHg89JV60_m1BlE,4633
|
|
33
33
|
tests/test_handy_mix_config.py,sha256=Un56mz9KJmdn4K4OwzHAHLSRzDU1Xv2nFrONNuzOG04,2594
|
|
34
34
|
tests/test_xml_parser.py,sha256=3QTlhFEd6KbK6nRFKZnc35tad6wqukTbe4QrFi8mr_8,859
|
|
35
|
-
berryworld-1.0.0.
|
|
36
|
-
berryworld-1.0.0.
|
|
37
|
-
berryworld-1.0.0.
|
|
38
|
-
berryworld-1.0.0.
|
|
35
|
+
berryworld-1.0.0.199316.dist-info/METADATA,sha256=EjHOVChJQB-PAZ-P7MQPQAvjwx_xB3wC7OL2qU40bsU,1445
|
|
36
|
+
berryworld-1.0.0.199316.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
berryworld-1.0.0.199316.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
|
|
38
|
+
berryworld-1.0.0.199316.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|