brynq-sdk-task-scheduler 4.0.5__tar.gz → 4.0.7__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.
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/PKG-INFO +1 -1
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler/task_scheduler.py +18 -5
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/PKG-INFO +1 -1
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/setup.py +1 -1
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler/__init__.py +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/not-zip-safe +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/requires.txt +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/brynq_sdk_task_scheduler.egg-info/top_level.txt +0 -0
- {brynq_sdk_task_scheduler-4.0.5 → brynq_sdk_task_scheduler-4.0.7}/setup.cfg +0 -0
|
@@ -69,6 +69,12 @@ class TaskScheduler:
|
|
|
69
69
|
self.mysql_reachable = True
|
|
70
70
|
try:
|
|
71
71
|
self.mysql = MySQL()
|
|
72
|
+
# override connection credentials always because they mightve been retrieved from an interface credential
|
|
73
|
+
self.mysql.host = os.getenv("MYSQL_HOST")
|
|
74
|
+
self.mysql.user = os.getenv("MYSQL_USER")
|
|
75
|
+
self.mysql.password = os.getenv("MYSQL_PASSWORD")
|
|
76
|
+
self.mysql.database = os.getenv("MYSQL_DATABASE")
|
|
77
|
+
self.mysql.port = 3306 if os.getenv("MYSQL_PORT") is None else int(os.getenv("MYSQL_PORT"))
|
|
72
78
|
self.mysql.ping()
|
|
73
79
|
except Exception as e:
|
|
74
80
|
self.mysql_reachable = False
|
|
@@ -248,8 +254,12 @@ class TaskScheduler:
|
|
|
248
254
|
filter=f'WHERE `reload_id` = {self.run_id}')
|
|
249
255
|
if self.email_after_errors:
|
|
250
256
|
self.email_errors(failed=True)
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
|
|
258
|
+
# Remove the temp values from the variables table (legacy), if it doesn't exist, ignore the error. In that case it will already be flushed by the API endpoint
|
|
259
|
+
try:
|
|
260
|
+
self.mysql.raw_query(f'UPDATE `task_variables` SET temp_value = null WHERE task_id = {self.task_id}', insert=True)
|
|
261
|
+
except Exception as e:
|
|
262
|
+
pass
|
|
253
263
|
|
|
254
264
|
# Start the chained tasks if it there are tasks which should start if this one is failed
|
|
255
265
|
self.start_chained_tasks(finished_task_status='FAILED')
|
|
@@ -302,8 +312,11 @@ class TaskScheduler:
|
|
|
302
312
|
values=['FinishedSuccess', f'{datetime.datetime.now()}'],
|
|
303
313
|
filter=f'WHERE `reload_id` = {self.run_id}')
|
|
304
314
|
|
|
305
|
-
# Remove the temp values from the variables table
|
|
306
|
-
|
|
315
|
+
# Remove the temp values from the variables table if it exists (legacy)
|
|
316
|
+
try:
|
|
317
|
+
self.mysql.raw_query(f'UPDATE `task_variables` SET temp_value = null WHERE task_id = {self.task_id}', insert=True)
|
|
318
|
+
except Exception as e:
|
|
319
|
+
pass
|
|
307
320
|
|
|
308
321
|
# Start the new task if it there is a task which should start if this one is finished
|
|
309
322
|
self.start_chained_tasks(finished_task_status='SUCCESS')
|
|
@@ -375,7 +388,7 @@ class TaskScheduler:
|
|
|
375
388
|
logs = []
|
|
376
389
|
logs.append(payload)
|
|
377
390
|
with open(log_file_path, 'w') as f:
|
|
378
|
-
json.dump(logs, f)
|
|
391
|
+
json.dump(logs, f, default=str)
|
|
379
392
|
except Exception as e:
|
|
380
393
|
print(f"Error saving log locally: {e}")
|
|
381
394
|
|
|
@@ -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.
|
|
5
|
+
version='4.0.7',
|
|
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',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|