watchmen-collector-kernel 16.6.12__py3-none-any.whl → 16.6.14__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.
- watchmen_collector_kernel/common/__init__.py +2 -1
- watchmen_collector_kernel/common/settings.py +11 -1
- watchmen_collector_kernel/model/scheduled_task.py +2 -1
- watchmen_collector_kernel/service/task_service.py +4 -0
- watchmen_collector_kernel/storage/change_data_json_service.py +18 -2
- watchmen_collector_kernel/storage/scheduled_task_service.py +13 -4
- {watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/METADATA +9 -9
- {watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/RECORD +10 -10
- {watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/LICENSE +0 -0
- {watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/WHEEL +0 -0
@@ -3,5 +3,6 @@ from .constants import CHANGE_RECORD_ID, TENANT_ID, IS_MERGED, LEFT_BRACE, RIGHT
|
|
3
3
|
from .settings import ask_clean_of_timeout_interval, ask_lock_timeout, ask_partial_size, \
|
4
4
|
ask_collector_config_cache_enabled, ask_collector_timeout, ask_clean_up_lock_timeout, \
|
5
5
|
ask_trigger_event_lock_timeout, ask_extract_table_lock_timeout, ask_s3_connector_lock_timeout, \
|
6
|
-
ask_collector_task_timeout, ask_exception_max_length
|
6
|
+
ask_collector_task_timeout, ask_exception_max_length, ask_grouped_task_data_size_threshold, \
|
7
|
+
ask_task_partial_size
|
7
8
|
from .exception import CollectorKernelException
|
@@ -15,7 +15,9 @@ class CollectorSettings(BaseSettings):
|
|
15
15
|
S3_CONNECTOR_LOCK_TIMEOUT = 300
|
16
16
|
PARTIAL_SIZE: int = 100
|
17
17
|
COLLECTOR_CONFIG_CACHE_ENABLED: bool = True
|
18
|
-
EXCEPTION_MAX_LENGTH =
|
18
|
+
EXCEPTION_MAX_LENGTH = 3000 # character
|
19
|
+
GROUPED_TASK_DATA_SIZE_THRESHOLD = 100
|
20
|
+
TASK_PARTIAL_SIZE: int = 100
|
19
21
|
|
20
22
|
class Config:
|
21
23
|
# secrets_dir = '/var/run'
|
@@ -70,3 +72,11 @@ def ask_collector_task_timeout() -> int:
|
|
70
72
|
|
71
73
|
def ask_exception_max_length() -> int:
|
72
74
|
return collector_settings.EXCEPTION_MAX_LENGTH
|
75
|
+
|
76
|
+
|
77
|
+
def ask_grouped_task_data_size_threshold() -> int:
|
78
|
+
return collector_settings.GROUPED_TASK_DATA_SIZE_THRESHOLD
|
79
|
+
|
80
|
+
|
81
|
+
def ask_task_partial_size() -> int:
|
82
|
+
return collector_settings.TASK_PARTIAL_SIZE
|
@@ -39,6 +39,10 @@ class TaskService:
|
|
39
39
|
executed(task.topicCode, task.content, task.tenantId)
|
40
40
|
elif task.type == TaskType.RUN_PIPELINE.value:
|
41
41
|
executed(task.topicCode, task.content, task.tenantId, task.pipelineId)
|
42
|
+
elif task.type == TaskType.GROUP.value:
|
43
|
+
raw_data_list = task.content.get("data")
|
44
|
+
for raw_data in raw_data_list:
|
45
|
+
executed(task.topicCode, raw_data, task.tenantId)
|
42
46
|
|
43
47
|
def update_task_result(self, task: ScheduledTask, status: int, result=None) -> ScheduledTask:
|
44
48
|
try:
|
@@ -144,6 +144,23 @@ class ChangeDataJsonService(TupleService):
|
|
144
144
|
limit=limit if limit is not None else ask_partial_size()
|
145
145
|
))
|
146
146
|
|
147
|
+
def find_json(self, model_trigger_id: int, limit: int = None) -> List:
|
148
|
+
try:
|
149
|
+
self.begin_transaction()
|
150
|
+
return self.storage.find_limited(
|
151
|
+
EntityLimitedFinder(
|
152
|
+
name=self.get_entity_name(),
|
153
|
+
shaper=self.get_entity_shaper(),
|
154
|
+
criteria=[
|
155
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=STATUS), right=0),
|
156
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=MODEL_TRIGGER_ID),
|
157
|
+
right=model_trigger_id)
|
158
|
+
],
|
159
|
+
limit=limit if limit is not None else ask_partial_size()
|
160
|
+
))
|
161
|
+
finally:
|
162
|
+
self.close_transaction()
|
163
|
+
|
147
164
|
def is_existed(self, change_json: ChangeDataJson) -> bool:
|
148
165
|
self.begin_transaction()
|
149
166
|
try:
|
@@ -187,8 +204,7 @@ class ChangeDataJsonService(TupleService):
|
|
187
204
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='object_id'), right=object_id),
|
188
205
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='model_trigger_id'),
|
189
206
|
right=model_trigger_id)
|
190
|
-
]
|
191
|
-
sort=[EntitySortColumn(name='sequence', method=EntitySortMethod.ASC)]
|
207
|
+
]
|
192
208
|
))
|
193
209
|
finally:
|
194
210
|
self.storage.close()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from typing import Optional, List, Any, Dict
|
3
3
|
|
4
|
-
from watchmen_collector_kernel.common import
|
4
|
+
from watchmen_collector_kernel.common import ask_task_partial_size, STATUS
|
5
5
|
from watchmen_utilities import ArrayHelper
|
6
6
|
|
7
7
|
from watchmen_auth import PrincipalService
|
@@ -124,6 +124,14 @@ class ScheduledTaskService(TupleService):
|
|
124
124
|
else:
|
125
125
|
return None
|
126
126
|
|
127
|
+
def find_one_and_lock_nowait(self, task_id: int) -> Optional[ScheduledTask]:
|
128
|
+
return self.storage.find_one_and_lock_nowait(self.get_entity_finder(
|
129
|
+
criteria=[
|
130
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='task_id'), right=task_id),
|
131
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='status'), right=0),
|
132
|
+
])
|
133
|
+
)
|
134
|
+
|
127
135
|
def find_unfinished_tasks(self) -> List[Dict[str, Any]]:
|
128
136
|
self.begin_transaction()
|
129
137
|
try:
|
@@ -150,7 +158,7 @@ class ScheduledTaskService(TupleService):
|
|
150
158
|
criteria=[
|
151
159
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='is_finished'), right=False)
|
152
160
|
],
|
153
|
-
pageable=Pageable(pageNumber=1, pageSize=
|
161
|
+
pageable=Pageable(pageNumber=1, pageSize=ask_task_partial_size())
|
154
162
|
)).data
|
155
163
|
finally:
|
156
164
|
self.close_transaction()
|
@@ -163,7 +171,7 @@ class ScheduledTaskService(TupleService):
|
|
163
171
|
criteria=[
|
164
172
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=STATUS), right=0)
|
165
173
|
],
|
166
|
-
limit=limit if limit is not None else
|
174
|
+
limit=limit if limit is not None else ask_task_partial_size()
|
167
175
|
))
|
168
176
|
|
169
177
|
def is_existed(self, task: ScheduledTask) -> bool:
|
@@ -209,7 +217,8 @@ class ScheduledTaskService(TupleService):
|
|
209
217
|
right=event_id),
|
210
218
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='tenant_id'),
|
211
219
|
right=tenant_id)
|
212
|
-
]
|
220
|
+
],
|
221
|
+
sort=[EntitySortColumn(name='task_id', method=EntitySortMethod.ASC)]
|
213
222
|
))
|
214
223
|
finally:
|
215
224
|
self.close_transaction()
|
{watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: watchmen-collector-kernel
|
3
|
-
Version: 16.6.
|
3
|
+
Version: 16.6.14
|
4
4
|
Summary:
|
5
5
|
License: MIT
|
6
6
|
Author: botlikes
|
@@ -20,11 +20,11 @@ Provides-Extra: oss
|
|
20
20
|
Provides-Extra: postgresql
|
21
21
|
Provides-Extra: s3
|
22
22
|
Requires-Dist: numpy (>=1.23.3,<2.0.0)
|
23
|
-
Requires-Dist: watchmen-data-kernel (==16.6.
|
24
|
-
Requires-Dist: watchmen-storage-mongodb (==16.6.
|
25
|
-
Requires-Dist: watchmen-storage-mssql (==16.6.
|
26
|
-
Requires-Dist: watchmen-storage-mysql (==16.6.
|
27
|
-
Requires-Dist: watchmen-storage-oracle (==16.6.
|
28
|
-
Requires-Dist: watchmen-storage-oss (==16.6.
|
29
|
-
Requires-Dist: watchmen-storage-postgresql (==16.6.
|
30
|
-
Requires-Dist: watchmen-storage-s3 (==16.6.
|
23
|
+
Requires-Dist: watchmen-data-kernel (==16.6.14)
|
24
|
+
Requires-Dist: watchmen-storage-mongodb (==16.6.14) ; extra == "mongodb"
|
25
|
+
Requires-Dist: watchmen-storage-mssql (==16.6.14) ; extra == "mssql"
|
26
|
+
Requires-Dist: watchmen-storage-mysql (==16.6.14) ; extra == "mysql"
|
27
|
+
Requires-Dist: watchmen-storage-oracle (==16.6.14) ; extra == "oracle"
|
28
|
+
Requires-Dist: watchmen-storage-oss (==16.6.14) ; extra == "oss"
|
29
|
+
Requires-Dist: watchmen-storage-postgresql (==16.6.14) ; extra == "postgresql"
|
30
|
+
Requires-Dist: watchmen-storage-s3 (==16.6.14) ; extra == "s3"
|
{watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/RECORD
RENAMED
@@ -6,10 +6,10 @@ watchmen_collector_kernel/cache/collector_topic_cache.py,sha256=jpr6-T4ETH5Oi7RI
|
|
6
6
|
watchmen_collector_kernel/cache/model_config_cache.py,sha256=WW2PmILHm0WbC9gr73uIq1B-poGx78Xpf1w9WEZLbJ8,1906
|
7
7
|
watchmen_collector_kernel/cache/module_config_cache.py,sha256=lGx-eIZLcLTa1RiH_kGU8soU1ilcfbE6KrYixim4Uhw,1393
|
8
8
|
watchmen_collector_kernel/cache/table_config_cache.py,sha256=oOjyatujD-J6hFcj42hxdmMhZylRdj8v5UXypTcqJQE,4390
|
9
|
-
watchmen_collector_kernel/common/__init__.py,sha256=
|
9
|
+
watchmen_collector_kernel/common/__init__.py,sha256=KCifKsnn6NPHkUMSq2q__fL9aWg52eK35a_mIfLKYRM,627
|
10
10
|
watchmen_collector_kernel/common/constants.py,sha256=mBc0dVjMXKp2pluN2HMNcArcOWvycNzLNu7zcZO0Eao,320
|
11
11
|
watchmen_collector_kernel/common/exception.py,sha256=AY4JAL0fBP6fAkgT7bfMTABp3x3oYtvV5vdPO5jI6S4,49
|
12
|
-
watchmen_collector_kernel/common/settings.py,sha256=
|
12
|
+
watchmen_collector_kernel/common/settings.py,sha256=Sivg_S8lEaEn6IdJFP6lrTB3JnQi5m_FCqoP37A9wqQ,2012
|
13
13
|
watchmen_collector_kernel/model/__init__.py,sha256=7FUgGxozQ3TMHBllZmds7g6nQbN2H6fID8cCLED7u04,845
|
14
14
|
watchmen_collector_kernel/model/change_data_json.py,sha256=ckCj2vvDoZCWryYE8lGjJnZ_WEfynsVrL2RvmKA2IUk,530
|
15
15
|
watchmen_collector_kernel/model/change_data_json_history.py,sha256=L9ACRe5tCP5Pc5MrpAVkLHe-6EfgZsUBfnQ2BXIYu4M,99
|
@@ -20,7 +20,7 @@ watchmen_collector_kernel/model/collector_module_config.py,sha256=0knkFhBdx4gpRX
|
|
20
20
|
watchmen_collector_kernel/model/collector_table_config.py,sha256=apxZRQmLEMsVK3Z8KnAUy61LRSITDhTEs1EVNTvC-M0,3266
|
21
21
|
watchmen_collector_kernel/model/competitive_lock.py,sha256=fxDRuzZpsgrZjGeuADS3zRYqQioqWhg72Pr592U_Yvw,264
|
22
22
|
watchmen_collector_kernel/model/condition.py,sha256=I0QSsz1pP2DRKsgfjw_M7Z_seaPFfzOCvlg6Ud2Te0s,1603
|
23
|
-
watchmen_collector_kernel/model/scheduled_task.py,sha256=
|
23
|
+
watchmen_collector_kernel/model/scheduled_task.py,sha256=Fzw_IeHGFYeEmWSQMajOb2WVCoX80wfmIL0scFG-6Ak,1491
|
24
24
|
watchmen_collector_kernel/model/scheduled_task_history.py,sha256=0lgWIQWN2r_HcMoLGwKxzLmaxGNtr0NZF7NaT_DeOyE,93
|
25
25
|
watchmen_collector_kernel/model/status.py,sha256=ctv8szNlnij5ZNQq2QPu5lWJds-QYwBX4kMAI6HqB3k,196
|
26
26
|
watchmen_collector_kernel/model/trigger_event.py,sha256=vERU5ebEAy_2d7Au6WAEkpszou9Svb9tnk4rjMMKEOk,479
|
@@ -37,12 +37,12 @@ watchmen_collector_kernel/service/lock_helper.py,sha256=Jwh9J4alPReXpuKmhNxFbZ6z
|
|
37
37
|
watchmen_collector_kernel/service/model_config_service.py,sha256=1tFd_MUldwl37JyRJF4FX6ywmFQ2caFYfslAlqnv2Jk,2235
|
38
38
|
watchmen_collector_kernel/service/module_config_service.py,sha256=M4Mn45WEV9rllpX4A9LhtVE7VjBo-Q9LrHnR4_U2UYA,2027
|
39
39
|
watchmen_collector_kernel/service/table_config_service.py,sha256=1jmaaOEM0ETRrTDGgGK7S9SCX85bPIP_jJ2zqsHH4DU,3962
|
40
|
-
watchmen_collector_kernel/service/task_service.py,sha256=
|
40
|
+
watchmen_collector_kernel/service/task_service.py,sha256=MRpdcMAH6N3M8WyJ3g9O47ZrHNsq9643bXVlIWqjQyg,4847
|
41
41
|
watchmen_collector_kernel/service/trigger_collector.py,sha256=p07SEQsfrBYIT02Ea5w9R70Yh7NAMC1TlFnn7hn79-o,10852
|
42
42
|
watchmen_collector_kernel/service/trigger_event_helper.py,sha256=l01bMQrHM-bij4_S0vdzHDuERaTZ4PFo7jQQMRw7dTc,17784
|
43
43
|
watchmen_collector_kernel/storage/__init__.py,sha256=064rAoXd3IkhPL6aVisW4BGYImKItD6h3btXsHkrBZo,1369
|
44
44
|
watchmen_collector_kernel/storage/change_data_json_history_service.py,sha256=8WPdazvG6EPTOtmiAXtb1yAMRwUaBmD-C6S0ZwsCMrw,1774
|
45
|
-
watchmen_collector_kernel/storage/change_data_json_service.py,sha256=
|
45
|
+
watchmen_collector_kernel/storage/change_data_json_service.py,sha256=ILEqtAs2vQzfzEtMd7w6lMkmHbf-hQa9f0GpWhcbXTo,12611
|
46
46
|
watchmen_collector_kernel/storage/change_data_record_history_service.py,sha256=q_41H2AQGLf_XD2W6ZsATLWvxpdK50swOWt5IMCTWjg,1845
|
47
47
|
watchmen_collector_kernel/storage/change_data_record_service.py,sha256=6-b12-NmGPeO2LOUpHVc6uHtuUjU4cgIHe4LdjoG1KU,10458
|
48
48
|
watchmen_collector_kernel/storage/collector_model_config_service.py,sha256=vIgiqVfxx94DuJVmZ9m-P7cKgfH5py54WfCn_BlYKqU,4555
|
@@ -50,12 +50,12 @@ watchmen_collector_kernel/storage/collector_module_config_service.py,sha256=OB4q
|
|
50
50
|
watchmen_collector_kernel/storage/collector_table_config_service.py,sha256=PcXEgW4igoEqeTbYI8uikudRFuom4a-G9eGUAzjH9Vo,7705
|
51
51
|
watchmen_collector_kernel/storage/competitive_lock_service.py,sha256=SIXpoeRP1S88ZQJy_-iZgGV9HTJwwM5r3vJn7J9WJbU,3154
|
52
52
|
watchmen_collector_kernel/storage/scheduled_task_history_service.py,sha256=f-JXZ5G87oy7FdYPkbbfTKhI_oRm4wauWNvTw9hxGjM,1586
|
53
|
-
watchmen_collector_kernel/storage/scheduled_task_service.py,sha256=
|
53
|
+
watchmen_collector_kernel/storage/scheduled_task_service.py,sha256=ENDhcjPzFkwr2YlLtOMiEerROyeUGufQM9G_LEw4-BE,10644
|
54
54
|
watchmen_collector_kernel/storage/trigger_event_service.py,sha256=pQwfrwt6-6qkJvorO28dTR7cGuvcmvFQUMPUfTujjWg,6836
|
55
55
|
watchmen_collector_kernel/storage/trigger_model_service.py,sha256=FE_88sYzh9ibUS1bOyDmGvryfPQraqkMbZc3BKtzfpI,3760
|
56
56
|
watchmen_collector_kernel/storage/trigger_module_service.py,sha256=Ca4J8vnBzS90qP3ljwDJ7lt6MzaOushGjoFRwsSKfHI,3377
|
57
57
|
watchmen_collector_kernel/storage/trigger_table_service.py,sha256=TRAFknaX6IW8lX7dMCR4y_3yjA2bYFFH1HdwW21--Kc,3915
|
58
|
-
watchmen_collector_kernel-16.6.
|
59
|
-
watchmen_collector_kernel-16.6.
|
60
|
-
watchmen_collector_kernel-16.6.
|
61
|
-
watchmen_collector_kernel-16.6.
|
58
|
+
watchmen_collector_kernel-16.6.14.dist-info/LICENSE,sha256=iuuG7ErblOdcEZi5u89VXS0VIUiTb4flerGp_PAS9E4,1061
|
59
|
+
watchmen_collector_kernel-16.6.14.dist-info/METADATA,sha256=mt-ZJYPm9rayBe8c-cBWBuBpdwUxjg700cJBksL7Iuw,1234
|
60
|
+
watchmen_collector_kernel-16.6.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
61
|
+
watchmen_collector_kernel-16.6.14.dist-info/RECORD,,
|
{watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/LICENSE
RENAMED
File without changes
|
{watchmen_collector_kernel-16.6.12.dist-info → watchmen_collector_kernel-16.6.14.dist-info}/WHEEL
RENAMED
File without changes
|