berryworld 1.0.0.199021__py3-none-any.whl → 1.0.0.199285__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 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 .sql_connenction import SQLConnection, SQLConnectionPool, SQLPoolEngine
27
+ from .sql_connection import SQLConnection, SQLConnectionPool, SQLPoolEngine
berryworld/python_logs.py CHANGED
@@ -49,14 +49,13 @@ class ErrorLogs:
49
49
  """ Update log on success
50
50
  :param pipeline: Pipeline name being run. It must identify the process being executed uniquely
51
51
  """
52
- if not any(self.failure_type):
52
+ if len(self.failure_type) == 0:
53
53
  if pipeline is not None:
54
54
  self.pipeline = pipeline
55
55
  successful_columns = {'Successful': 1, 'Resolved': 1, 'Pipeline': self.pipeline, 'GuidKey': self.guid,
56
56
  'FinishedDate': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")}
57
57
  self.log_df = self.log_df.assign(**successful_columns)
58
58
  self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
59
- self.failure_type.append(True)
60
59
 
61
60
  Thread(target=self.trigger_merge_stored_procedure).start()
62
61
 
@@ -68,27 +67,19 @@ class ErrorLogs:
68
67
  :param critical: Indicate whether it should avoid sending successful logs
69
68
  :param proposed_solution: Proposed solution to the error message
70
69
  """
71
- save_failure = True
72
- if section is not None:
73
- if ((('prod' not in str(self.sql_con.server)) | ('prd' not in str(self.sql_con.server)))
74
- & (('connection' in str(section).lower()) & ('dw' in str(section).lower()))):
75
- print('Avoiding to report a connection DW error in a non-production environment')
76
- save_failure = False
70
+ if pipeline is not None:
71
+ self.pipeline = pipeline
72
+ unsuccessful_columns = {'Successful': 0, 'Section': section, 'Pipeline': self.pipeline,
73
+ 'GuidKey': self.guid, 'Critical': 1 if critical is True else 0,
74
+ 'FinishedDate': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
75
+ 'ErrorMessage': str(error_message).replace("'", '"')}
76
+ self.log_df = self.log_df.assign(**unsuccessful_columns)
77
+ if proposed_solution is not None:
78
+ self.log_df = self.log_df.assign(**{'ProposedSolution': proposed_solution})
79
+ self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
80
+ self.failure_type.append(critical)
77
81
 
78
- if save_failure:
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()
82
+ Thread(target=self.trigger_merge_stored_procedure).start()
92
83
 
93
84
  def trigger_merge_stored_procedure(self):
94
85
  """ Trigger the merge stored procedure to aggregate logs
@@ -97,16 +88,17 @@ class ErrorLogs:
97
88
  self.sql_con.run_statement(f"EXEC {stored_procedure}")
98
89
 
99
90
  @staticmethod
100
- def register_failure(email_log, section, error_, solutions=None):
91
+ def register_failure(email_log, section, error_, solutions=None, pipeline=None):
101
92
  """Register a failure in the email log
102
93
  :param email_log: Instance of PythonEmailProjectSeverity
103
94
  :param section: Indicate the script section. Useful to locate the error
104
95
  :param error_: Error message to be sent in the Log
105
96
  :param solutions: List of solutions for the error messages
97
+ :param pipeline: Pipeline name being run. It must identify the process being executed uniquely
106
98
  """
107
99
  solution_header = list(filter(lambda x: section.startswith(x), list(solutions.keys())))
108
100
  if len(solution_header) > 0:
109
101
  proposed_solution = solutions[solution_header[0]]
110
- email_log.on_failure(error_, section=section, proposed_solution=proposed_solution)
102
+ email_log.on_failure(error_, section=section, proposed_solution=proposed_solution, pipeline=pipeline)
111
103
  else:
112
- email_log.on_failure(error_, section=section)
104
+ email_log.on_failure(error_, section=section, pipeline=pipeline)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: berryworld
3
- Version: 1.0.0.199021
3
+ Version: 1.0.0.199285
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -1,4 +1,4 @@
1
- berryworld/__init__.py,sha256=xYQwJeCZ2di85E0_O3Sx8AUsRhoT6USUxcPGJyCr-gY,1175
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=SEWrzK5kpG6kd_7qjGXd-d5SiVgEm595Tuud14uGGzw,5810
19
+ berryworld/python_logs.py,sha256=c4zlgSHe3BALudnK_oxbVwJmo9KYdLuxYbiVmZOWX8s,5456
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/sql_connenction.py,sha256=IJAOsQ7p0tMFEEucazmmkS3lNonf_YFWftyZ_kGPHj8,104150
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.199021.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
30
+ berryworld-1.0.0.199285.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.199021.dist-info/METADATA,sha256=RVDaYgMC_ojVtgoJQL2uXuIA8TsqPxLwPpgntPyeFQM,1445
36
- berryworld-1.0.0.199021.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- berryworld-1.0.0.199021.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
38
- berryworld-1.0.0.199021.dist-info/RECORD,,
35
+ berryworld-1.0.0.199285.dist-info/METADATA,sha256=A5kwsq1VMBIOHhH1wQC0lqe2liBGFPC7Bp0aozgelxE,1445
36
+ berryworld-1.0.0.199285.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ berryworld-1.0.0.199285.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
38
+ berryworld-1.0.0.199285.dist-info/RECORD,,
File without changes