brynq-sdk-task-scheduler 4.0.0__tar.gz → 4.0.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq_sdk_task_scheduler
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -56,10 +56,6 @@ class TaskScheduler:
56
56
  self.local_log_dir = 'local_logs'
57
57
  os.makedirs(self.local_log_dir, exist_ok=True)
58
58
 
59
- # Process local logs if services are now reachable
60
- if self.mysql_enabled and self.mysql_reachable:
61
- self._process_local_mysql_logs()
62
-
63
59
  try:
64
60
  self.customer_db = os.getenv("MYSQL_DATABASE")
65
61
  self.customer = os.getenv('BRYNQ_SUBDOMAIN').lower().replace(' ', '_')
@@ -80,11 +76,12 @@ class TaskScheduler:
80
76
  except Exception as e:
81
77
  self.mysql_reachable = False
82
78
  self.mysql = None
83
- print("MySQL is enabled but not reachable, logs will be saved locally if needed.")
79
+ print("MySQL is not reachable, logs will be saved locally if needed.")
84
80
 
85
81
  # Start the task and setup the data in the database
86
82
  if self.mysql_enabled and self.mysql_reachable:
87
83
  self.customer_id = self.mysql.raw_query(f'SELECT id FROM sc.customers WHERE dbname = \'{self.customer_db}\'')[0][0]
84
+ self._process_local_mysql_logs()
88
85
  self._start_task()
89
86
  except Exception as e:
90
87
  self.error_handling(e)
@@ -129,7 +126,7 @@ class TaskScheduler:
129
126
  if self.started_local:
130
127
  self.mysql.raw_query(f"INSERT INTO `task_scheduler_log` (reload_id, task_id, reload_status, started_at, finished_at) VALUES ({self.run_id}, {self.task_id}, 'Running', '{self.started_at}', null)", insert=True)
131
128
 
132
- self.mysql.update('task_scheduler', ['status', 'step_nr'], ['RUNNING', 1], f'WHERE `id` = {self.task_id}')
129
+ self.mysql.update('task_scheduler', ['status', 'step_nr', 'run_instant'], ['RUNNING', 1, 0], f'WHERE `id` = {self.task_id}')
133
130
 
134
131
  def db_variable(self, variable_name: str):
135
132
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-task-scheduler
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name='brynq_sdk_task_scheduler',
5
- version='4.0.0',
5
+ version='4.0.2',
6
6
  description='Code to execute tasks in BrynQ.com with the task scheduler',
7
7
  long_description='Code to execute tasks in the BrynQ.com platform with the task scheduler',
8
8
  author='BrynQ',