berryworld 1.0.0.199285__py3-none-any.whl → 1.0.0.199342__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/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
- time_range = math.ceil(self.timeout / 10)
38
+ step = 10
39
+ time_range = math.ceil(self.timeout / step)
38
40
  for times in range(time_range):
39
- time.sleep(10)
40
- if len(self.failure_type) > 0:
41
+ time.sleep(step)
42
+ if self.completed:
41
43
  break
42
44
 
43
- if len(self.failure_type) == 0:
45
+ if not self.completed:
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,13 +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 len(self.failure_type) == 0:
54
+ if not self.completed:
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)
61
+ self.completed = True
59
62
 
60
63
  Thread(target=self.trigger_merge_stored_procedure).start()
61
64
 
@@ -77,7 +80,8 @@ class ErrorLogs:
77
80
  if proposed_solution is not None:
78
81
  self.log_df = self.log_df.assign(**{'ProposedSolution': proposed_solution})
79
82
  self.sql_con.insert(self.log_df, 'Staging', 'Logs', print_sql=self.print_sql)
80
- self.failure_type.append(critical)
83
+ self.completed = True
84
+ self.failure_type.append(self.completed)
81
85
 
82
86
  Thread(target=self.trigger_merge_stored_procedure).start()
83
87
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: berryworld
3
- Version: 1.0.0.199285
3
+ Version: 1.0.0.199342
4
4
  Summary: Handy classes to improve ETL processes
5
5
  Home-page: https://www.berryworld.com
6
6
  Author: BerryWorld ltd
@@ -16,7 +16,7 @@ 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=c4zlgSHe3BALudnK_oxbVwJmo9KYdLuxYbiVmZOWX8s,5456
19
+ berryworld/python_logs.py,sha256=w6Ww0GrntNrwDx-S2U_NEOVS7RQgtBfMrY8XcWDgjL4,5549
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
@@ -27,12 +27,12 @@ berryworld/verify_keys.py,sha256=X7VUHqYDklWPDO0bGVHIOXeLq5Qi4fZRZbHYw5x7UnA,435
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.199285.dist-info/licenses/LICENSE,sha256=vtkVCJM6E2af2gnsi2XxKPr4WY-uIbvzVLXieFND0UU,1074
30
+ berryworld-1.0.0.199342.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.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,,
35
+ berryworld-1.0.0.199342.dist-info/METADATA,sha256=5MaUIaoCVXkL0IcupYBtsZtGHjCKQbmW9XGRO05Yuz0,1445
36
+ berryworld-1.0.0.199342.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ berryworld-1.0.0.199342.dist-info/top_level.txt,sha256=GIZ5qy-P5oxfEH755vA1IMFeTVdX3-40JxMe6nOe5I8,17
38
+ berryworld-1.0.0.199342.dist-info/RECORD,,