brynq-sdk-task-scheduler 4.0.7__tar.gz → 4.0.10__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.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: brynq_sdk_task_scheduler
3
+ Version: 4.0.10
4
+ Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
+ Author: BrynQ
6
+ Author-email: support@brynq.com
7
+ License: BrynQ License
8
+ Requires-Dist: brynq-sdk-brynq<5,>=4
9
+ Requires-Dist: brynq-sdk-functions<3,>=2
10
+ Requires-Dist: brynq-sdk-mysql<4,>=3
11
+ Requires-Dist: brynq-sdk-mandrill<4,>=2
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: license
16
+ Dynamic: requires-dist
17
+ Dynamic: summary
18
+
19
+ Code to execute tasks in the BrynQ.com platform with the task scheduler
@@ -3,7 +3,7 @@ import os
3
3
  import datetime
4
4
  import inspect
5
5
  import time
6
- from typing import Literal, List, Optional
6
+ from typing import Literal, List, Optional, Union
7
7
  import traceback
8
8
  import pandas as pd
9
9
  import json
@@ -19,11 +19,11 @@ import re
19
19
 
20
20
  class TaskScheduler:
21
21
 
22
- def __init__(self, data_interface_id: int = None, loglevel: str = 'INFO', email_after_errors: bool = False):
22
+ def __init__(self, data_interface_id: Union[int, str] = None, loglevel: str = 'INFO', email_after_errors: bool = False):
23
23
  """
24
24
  The TaskScheduler is responsible for the logging to the database. Based on this logging, the next reload will
25
25
  start or not and warning will be given or not
26
- :param data_interface_id: The ID from the task as saved in the task_scheduler table in the customer database
26
+ :param data_interface_id: The ID or GUID from the task as saved in the task_scheduler table in the customer database
27
27
  :param email_after_errors: a True or False value. When True, there will be send an email to a contactperson of the customer (as given in the database) with the number of errors
28
28
  :param loglevel: Chose on which level you want to store the logs. Default is INFO. that means that a logline
29
29
  :param disable_logging: If the interface is started from a local instance, logs will not be stored by default. If this is set to True, the logs will be stored in the database
@@ -323,13 +323,14 @@ class TaskScheduler:
323
323
 
324
324
  # Clean up execution log
325
325
  # set this date filter above the actual delete filter because of the many uncooperative quotation marks involved in the whole filter
326
- log_date_limit_filter = f"AND created_at >= \'{log_date_limit.strftime('%Y-%m-%d')}\'" if log_date_limit is not None else None
326
+ print(f"Deleting logs with filters: Date limit: {log_date_limit}, Max no. of entries: {log_limit} INFO logs")
327
+ log_date_limit_filter = f"AND created_at >= \'{log_date_limit.strftime('%Y-%m-%d')}\'" if log_date_limit is not None else ''
328
+ log_limit_filter = f"LIMIT {log_limit}" if log_limit is not None else ""
327
329
  delete_filter = f"WHERE task_id = {self.task_id} " \
330
+ f"AND log_level NOT IN ('CRITICAL', 'ERROR') " \
328
331
  f"AND reload_id NOT IN (SELECT reload_id FROM (SELECT reload_id FROM `task_execution_log` WHERE task_id = {self.task_id} " \
329
- f"AND log_level != 'CRITICAL' " \
330
- f"AND log_level != 'ERROR' " \
331
- f"{log_date_limit_filter if log_date_limit_filter is not None else ''} " \
332
- f"ORDER BY created_at DESC {f' LIMIT {log_limit} ' if log_limit is not None else ''}) temp)"
332
+ f"{log_date_limit_filter} " \
333
+ f"ORDER BY created_at DESC {log_limit_filter}) temp)"
333
334
  resp = self.mysql.delete(table="task_execution_log", filter=delete_filter)
334
335
  print(resp)
335
336
  print(f'{datetime.datetime.now()} - Task finished')
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: brynq_sdk_task_scheduler
3
+ Version: 4.0.10
4
+ Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
+ Author: BrynQ
6
+ Author-email: support@brynq.com
7
+ License: BrynQ License
8
+ Requires-Dist: brynq-sdk-brynq<5,>=4
9
+ Requires-Dist: brynq-sdk-functions<3,>=2
10
+ Requires-Dist: brynq-sdk-mysql<4,>=3
11
+ Requires-Dist: brynq-sdk-mandrill<4,>=2
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: license
16
+ Dynamic: requires-dist
17
+ Dynamic: summary
18
+
19
+ Code to execute tasks in the BrynQ.com platform with the task scheduler
@@ -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.7',
5
+ version='4.0.10',
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',
@@ -1,10 +0,0 @@
1
- Metadata-Version: 1.0
2
- Name: brynq_sdk_task_scheduler
3
- Version: 4.0.7
4
- Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
- Home-page: UNKNOWN
6
- Author: BrynQ
7
- Author-email: support@brynq.com
8
- License: BrynQ License
9
- Description: Code to execute tasks in the BrynQ.com platform with the task scheduler
10
- Platform: UNKNOWN
@@ -1,10 +0,0 @@
1
- Metadata-Version: 1.0
2
- Name: brynq-sdk-task-scheduler
3
- Version: 4.0.7
4
- Summary: Code to execute tasks in BrynQ.com with the task scheduler
5
- Home-page: UNKNOWN
6
- Author: BrynQ
7
- Author-email: support@brynq.com
8
- License: BrynQ License
9
- Description: Code to execute tasks in the BrynQ.com platform with the task scheduler
10
- Platform: UNKNOWN