brynq-sdk-task-scheduler 2.0.0__tar.gz → 2.0.1__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: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -351,7 +351,6 @@ class TaskScheduler(BrynQ):
351
351
 
352
352
  raise Exception(error)
353
353
 
354
-
355
354
  def finish_task(self, reload_instant=False, log_limit: typing.Optional[int] = 10000, log_date_limit: datetime.date = None):
356
355
  """
357
356
  At the end of the script, write the outcome to the database. Write if the task is finished with or without errors, Email to a contactperson if this variable is given in the
@@ -424,10 +423,17 @@ class TaskScheduler(BrynQ):
424
423
  email_list = []
425
424
  for i in email_to:
426
425
  email_list.append({'name': 'BrynQ User', 'mail': i.strip()})
426
+
427
+ # Recieve the task name and the finished_at time from the task_scheduler table joined with the data_interfaces table
428
+ response = self.mysql.select(
429
+ table='task_scheduler LEFT JOIN data_interfaces ON task_scheduler.data_interface_id = data_interfaces.id ',
430
+ selection="title, last_reload",
431
+ filter=f'WHERE task_scheduler.id = {self.task_id}'
432
+ )
433
+ task = response[0][0]
434
+ finished_at = response[0][1]
435
+
427
436
  # Set the content of the mail and all other stuff
428
- task = self.mysql.select(table='data_interfaces', selection='title', filter=f'WHERE id = {self.task_id}')[0][0]
429
- finished_at = \
430
- self.mysql.select(table='task_scheduler', selection='last_reload', filter=f'WHERE data_interface_id = {self.task_id}')[0][0]
431
437
  if failed:
432
438
  subject = f'Task \'{task}\' has failed'
433
439
  content = f'Task \'{task}\' with task ID \'{self.task_id}\' failed during its last run and was stopped at {finished_at}. ' \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: brynq-sdk-task-scheduler
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
5
  Home-page: UNKNOWN
6
6
  Author: BrynQ
@@ -3,7 +3,7 @@ from setuptools import setup
3
3
 
4
4
  setup(
5
5
  name='brynq_sdk_task_scheduler',
6
- version='2.0.0',
6
+ version='2.0.1',
7
7
  description='Code to execute tasks in BrynQ.com with the task scheduler',
8
8
  long_description='Code to execute tasks in the BrynQ.com platform with the task scheduler',
9
9
  author='BrynQ',