watchmen-collector-kernel 16.4.8__tar.gz → 16.4.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.
- watchmen_collector_kernel-16.4.10/PKG-INFO +29 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/pyproject.toml +10 -9
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/common/__init__.py +1 -0
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/common/settings.py +32 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/__init__.py +3 -1
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/model/change_data_json_history.py +6 -0
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/model/change_data_record_history.py +5 -0
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/model/scheduled_task.py +53 -0
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/model/scheduled_task_history.py +5 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/lock_clean.py +4 -2
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/task_service.py +24 -12
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/__init__.py +4 -0
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/storage/change_data_json_history_service.py +48 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/change_data_json_service.py +34 -3
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/storage/change_data_record_history_service.py +47 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/change_data_record_service.py +24 -8
- watchmen_collector_kernel-16.4.10/src/watchmen_collector_kernel/storage/scheduled_task_history_service.py +45 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/scheduled_task_service.py +60 -11
- watchmen_collector_kernel-16.4.8/PKG-INFO +0 -28
- watchmen_collector_kernel-16.4.8/setup.py +0 -48
- watchmen_collector_kernel-16.4.8/src/watchmen_collector_kernel/model/scheduled_task.py +0 -36
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/LICENSE +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/__init__.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/common/constants.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/change_data_json.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/change_data_record.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/collector_model_config.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/collector_table_config.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/competitive_lock.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/condition.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/trigger_event.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/trigger_model.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/model/trigger_table.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/__init__.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/criteria_builder.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/data_capture.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/extract_source.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/extract_utils.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/lock_helper.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/task_housekeeping.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/service/trigger_collector.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/collector_model_config_service.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/collector_table_config_service.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/competitive_lock_service.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/trigger_event_service.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/trigger_model_service.py +0 -0
- {watchmen_collector_kernel-16.4.8 → watchmen_collector_kernel-16.4.10}/src/watchmen_collector_kernel/storage/trigger_table_service.py +0 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: watchmen-collector-kernel
|
3
|
+
Version: 16.4.10
|
4
|
+
Summary:
|
5
|
+
License: MIT
|
6
|
+
Author: botlikes
|
7
|
+
Author-email: 75356972+botlikes456@users.noreply.github.com
|
8
|
+
Requires-Python: >=3.9,<4.0
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
14
|
+
Provides-Extra: mongodb
|
15
|
+
Provides-Extra: mssql
|
16
|
+
Provides-Extra: mysql
|
17
|
+
Provides-Extra: oracle
|
18
|
+
Provides-Extra: oss
|
19
|
+
Provides-Extra: postgresql
|
20
|
+
Provides-Extra: s3
|
21
|
+
Requires-Dist: numpy (>=1.23.3,<2.0.0)
|
22
|
+
Requires-Dist: watchmen-data-kernel (==16.4.10)
|
23
|
+
Requires-Dist: watchmen-storage-mongodb (==16.4.10) ; extra == "mongodb"
|
24
|
+
Requires-Dist: watchmen-storage-mssql (==16.4.10) ; extra == "mssql"
|
25
|
+
Requires-Dist: watchmen-storage-mysql (==16.4.10) ; extra == "mysql"
|
26
|
+
Requires-Dist: watchmen-storage-oracle (==16.4.10) ; extra == "oracle"
|
27
|
+
Requires-Dist: watchmen-storage-oss (==16.4.10) ; extra == "oss"
|
28
|
+
Requires-Dist: watchmen-storage-postgresql (==16.4.10) ; extra == "postgresql"
|
29
|
+
Requires-Dist: watchmen-storage-s3 (==16.4.10) ; extra == "s3"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "watchmen-collector-kernel"
|
3
|
-
version = "16.4.
|
3
|
+
version = "16.4.10"
|
4
4
|
description = ""
|
5
5
|
authors = ["botlikes <75356972+botlikes456@users.noreply.github.com>"]
|
6
6
|
license = "MIT"
|
@@ -10,14 +10,15 @@ packages = [
|
|
10
10
|
|
11
11
|
[tool.poetry.dependencies]
|
12
12
|
python = "^3.9"
|
13
|
-
|
14
|
-
watchmen-
|
15
|
-
watchmen-storage-
|
16
|
-
watchmen-storage-
|
17
|
-
watchmen-storage-
|
18
|
-
watchmen-storage-
|
19
|
-
watchmen-storage-
|
20
|
-
watchmen-storage-
|
13
|
+
numpy = "^1.23.3"
|
14
|
+
watchmen-data-kernel = "16.4.10"
|
15
|
+
watchmen-storage-mysql = { version = "16.4.10", optional = true }
|
16
|
+
watchmen-storage-oracle = { version = "16.4.10", optional = true }
|
17
|
+
watchmen-storage-mongodb = { version = "16.4.10", optional = true }
|
18
|
+
watchmen-storage-mssql = { version = "16.4.10", optional = true }
|
19
|
+
watchmen-storage-postgresql = { version = "16.4.10", optional = true }
|
20
|
+
watchmen-storage-oss = { version = "16.4.10", optional = true }
|
21
|
+
watchmen-storage-s3 = { version = "16.4.10", optional = true }
|
21
22
|
|
22
23
|
[tool.poetry.dev-dependencies]
|
23
24
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from pydantic import BaseSettings
|
2
|
+
from logging import getLogger
|
3
|
+
|
4
|
+
logger = getLogger(__name__)
|
5
|
+
|
6
|
+
|
7
|
+
class CollectorSettings(BaseSettings):
|
8
|
+
LOCK_CLEAN_INTERVAL: int = 60
|
9
|
+
LOCK_CLEAN_TIMEOUT: int = 3600
|
10
|
+
PARTIAL_SIZE: int = 10000
|
11
|
+
|
12
|
+
class Config:
|
13
|
+
# secrets_dir = '/var/run'
|
14
|
+
env_file = '.env'
|
15
|
+
env_file_encoding = 'utf-8'
|
16
|
+
case_sensitive = True
|
17
|
+
|
18
|
+
|
19
|
+
collector_settings = CollectorSettings()
|
20
|
+
logger.info(f'Collector settings[{collector_settings.dict()}].')
|
21
|
+
|
22
|
+
|
23
|
+
def ask_lock_clean_interval() -> int:
|
24
|
+
return collector_settings.LOCK_CLEAN_INTERVAL
|
25
|
+
|
26
|
+
|
27
|
+
def ask_lock_clean_timeout() -> int:
|
28
|
+
return collector_settings.LOCK_CLEAN_TIMEOUT
|
29
|
+
|
30
|
+
|
31
|
+
def ask_partial_size() -> int:
|
32
|
+
return collector_settings.PARTIAL_SIZE
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .competitive_lock import CompetitiveLock
|
2
|
-
from .scheduled_task import ScheduledTask
|
2
|
+
from .scheduled_task import ScheduledTask
|
3
3
|
|
4
4
|
from .collector_model_config import CollectorModelConfig
|
5
5
|
from .collector_table_config import CollectorTableConfig
|
@@ -9,7 +9,9 @@ from .trigger_model import TriggerModel
|
|
9
9
|
from .trigger_table import TriggerTable
|
10
10
|
|
11
11
|
from .change_data_record import ChangeDataRecord
|
12
|
+
from .change_data_record_history import ChangeDataRecordHistory
|
12
13
|
from .change_data_json import ChangeDataJson
|
14
|
+
from .change_data_json_history import ChangeDataJsonHistory
|
13
15
|
|
14
16
|
from .condition import construct_conditions, Condition, ConditionJoint, ConditionExpression, \
|
15
17
|
ConditionJointConjunction
|
@@ -0,0 +1,53 @@
|
|
1
|
+
from typing import Dict, List, Optional, Union
|
2
|
+
|
3
|
+
from watchmen_utilities import ArrayHelper
|
4
|
+
|
5
|
+
from watchmen_model.common import TenantBasedTuple, ScheduledTaskId, Storable
|
6
|
+
from pydantic import BaseModel
|
7
|
+
from enum import Enum
|
8
|
+
|
9
|
+
|
10
|
+
class Result(str, Enum):
|
11
|
+
DEPENDENCY_FAILED = "DEPENDENCY_FAILED"
|
12
|
+
PROCESS_TASK_SUCCESS = "PROCESS_TASK_SUCCESS"
|
13
|
+
PROCESS_TASK_FAILED = "PROCESS_TASK_FAILED"
|
14
|
+
|
15
|
+
|
16
|
+
class Dependence(Storable, BaseModel):
|
17
|
+
modelName: str
|
18
|
+
objectId: str
|
19
|
+
|
20
|
+
|
21
|
+
def construct_dependence(dependence: Union[Dependence, Dict]) -> Optional[Dependence]:
|
22
|
+
if dependence is None:
|
23
|
+
return None
|
24
|
+
elif isinstance(dependence, Dependence):
|
25
|
+
return dependence
|
26
|
+
else:
|
27
|
+
return Dependence(**dependence)
|
28
|
+
|
29
|
+
|
30
|
+
def construct_depend_on(depend_on: Optional[List[Union[Dependence, Dict]]]) -> Optional[List[Dependence]]:
|
31
|
+
if depend_on is None:
|
32
|
+
return None
|
33
|
+
else:
|
34
|
+
return ArrayHelper(depend_on).map(lambda x: construct_dependence(x)).to_list()
|
35
|
+
|
36
|
+
|
37
|
+
class ScheduledTask(TenantBasedTuple, BaseModel):
|
38
|
+
taskId: ScheduledTaskId
|
39
|
+
resourceId: str # global unique, monotonous increase
|
40
|
+
topicCode: str
|
41
|
+
content: Dict
|
42
|
+
modelName: str
|
43
|
+
objectId: str
|
44
|
+
dependOn: List[Dependence]
|
45
|
+
parentTaskId: List[int]
|
46
|
+
isFinished: bool
|
47
|
+
result: Dict
|
48
|
+
|
49
|
+
def __setattr__(self, name, value):
|
50
|
+
if name == 'dependOn':
|
51
|
+
super().__setattr__(name, construct_depend_on(value))
|
52
|
+
else:
|
53
|
+
super().__setattr__(name, value)
|
@@ -4,6 +4,7 @@ from threading import Thread
|
|
4
4
|
|
5
5
|
from time import sleep
|
6
6
|
|
7
|
+
from watchmen_collector_kernel.common import ask_lock_clean_interval, ask_lock_clean_timeout
|
7
8
|
from watchmen_collector_kernel.storage import get_competitive_lock_service
|
8
9
|
from watchmen_meta.common import ask_meta_storage
|
9
10
|
|
@@ -12,7 +13,8 @@ class LockClean:
|
|
12
13
|
|
13
14
|
def __init__(self):
|
14
15
|
self.lock_service = get_competitive_lock_service(ask_meta_storage())
|
15
|
-
self.cleanInterval =
|
16
|
+
self.cleanInterval = ask_lock_clean_interval()
|
17
|
+
self.cleanTimeout = ask_lock_clean_timeout()
|
16
18
|
|
17
19
|
def run(self):
|
18
20
|
try:
|
@@ -25,7 +27,7 @@ class LockClean:
|
|
25
27
|
self.restart()
|
26
28
|
|
27
29
|
def clean_lock(self):
|
28
|
-
query_time = datetime.now() - timedelta(
|
30
|
+
query_time = datetime.now() - timedelta(seconds=self.cleanTimeout)
|
29
31
|
locks = self.lock_service.find_overtime_lock(query_time)
|
30
32
|
for lock in locks:
|
31
33
|
self.lock_service.delete_by_id(lock.lockId)
|
@@ -3,9 +3,9 @@ from traceback import format_exc
|
|
3
3
|
from typing import Callable, Dict, Optional, List
|
4
4
|
|
5
5
|
from watchmen_auth import PrincipalService
|
6
|
-
from watchmen_collector_kernel.model import ScheduledTask
|
6
|
+
from watchmen_collector_kernel.model import ScheduledTask
|
7
7
|
from watchmen_collector_kernel.model.scheduled_task import Dependence
|
8
|
-
from watchmen_collector_kernel.storage import get_scheduled_task_service
|
8
|
+
from watchmen_collector_kernel.storage import get_scheduled_task_service, get_scheduled_task_history_service
|
9
9
|
from watchmen_model.common import ScheduledTaskId
|
10
10
|
from watchmen_storage import TransactionalStorageSPI, SnowflakeGenerator
|
11
11
|
from watchmen_utilities import ArrayHelper
|
@@ -26,33 +26,45 @@ class TaskService:
|
|
26
26
|
self.scheduled_task_service = get_scheduled_task_service(self.storage,
|
27
27
|
self.snowflake_generator,
|
28
28
|
self.principal_service)
|
29
|
+
self.scheduled_task_history_service = get_scheduled_task_history_service(self.storage,
|
30
|
+
self.snowflake_generator,
|
31
|
+
self.principal_service)
|
29
32
|
|
30
33
|
# noinspection PyMethodMayBeStatic
|
31
34
|
def consume_task(self, task: ScheduledTask, executed: Callable[[str, Dict, str], None]) -> ScheduledTask:
|
32
35
|
try:
|
33
36
|
executed(task.topicCode, task.content, task.tenantId)
|
34
|
-
|
35
|
-
return self.scheduled_task_service.update_task(task)
|
37
|
+
return self.update_task_result(task)
|
36
38
|
except Exception as e:
|
37
39
|
logger.error(e, exc_info=True, stack_info=True)
|
38
|
-
task.
|
40
|
+
task.isFinished = True
|
39
41
|
task.result = format_exc()
|
40
42
|
return self.scheduled_task_service.update_task(task)
|
41
43
|
|
44
|
+
def update_task_result(self, task: ScheduledTask) -> ScheduledTask:
|
45
|
+
self.scheduled_task_service.begin_transaction()
|
46
|
+
try:
|
47
|
+
task.isFinished = True
|
48
|
+
self.scheduled_task_history_service.create(task)
|
49
|
+
self.scheduled_task_service.delete(task.taskId)
|
50
|
+
self.scheduled_task_service.commit_transaction()
|
51
|
+
return task
|
52
|
+
except Exception as e:
|
53
|
+
raise e
|
54
|
+
|
42
55
|
def is_dependencies_finished(self, task: ScheduledTask) -> bool:
|
43
|
-
return ArrayHelper(task.parentTaskId).every(self.is_parent_task_finished)
|
44
|
-
and self.is_dependence_finished(task.dependOn, task.tenantId)
|
56
|
+
return ArrayHelper(task.parentTaskId).every(self.is_parent_task_finished) and self.is_dependence_finished(task.dependOn, task.tenantId)
|
45
57
|
|
46
58
|
def is_parent_task_finished(self, task_id: ScheduledTaskId) -> bool:
|
47
59
|
existed_task = self.scheduled_task_service.find_task_by_id(task_id)
|
48
|
-
|
60
|
+
if existed_task:
|
61
|
+
return self.is_finished(existed_task)
|
62
|
+
else:
|
63
|
+
return True
|
49
64
|
|
50
65
|
# noinspection PyMethodMayBeStatic
|
51
66
|
def is_finished(self, task: ScheduledTask) -> bool:
|
52
|
-
|
53
|
-
return True
|
54
|
-
else:
|
55
|
-
return False
|
67
|
+
return task.isFinished
|
56
68
|
|
57
69
|
def is_dependence_finished(self, depend_on: Optional[List[Dependence]], tenant_id: str) -> bool:
|
58
70
|
if ArrayHelper(depend_on).every(lambda dependence: self.is_dependent_task_finished(dependence, tenant_id)):
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from .competitive_lock_service import get_competitive_lock_service, CompetitiveLockService
|
2
2
|
from .scheduled_task_service import get_scheduled_task_service, ScheduledTaskService
|
3
|
+
from .scheduled_task_history_service import get_scheduled_task_history_service, ScheduledTaskHistoryService
|
3
4
|
|
4
5
|
|
5
6
|
from .collector_model_config_service import get_collector_model_config_service, CollectorModelConfigService
|
@@ -9,8 +10,11 @@ from .collector_table_config_service import get_collector_table_config_service,
|
|
9
10
|
from .trigger_event_service import get_trigger_event_service, TriggerEventService
|
10
11
|
from .trigger_model_service import get_trigger_model_service, TriggerModelService
|
11
12
|
from .trigger_table_service import get_trigger_table_service, TriggerTableService
|
13
|
+
|
12
14
|
from .change_data_record_service import get_change_data_record_service, ChangeDataRecordService
|
15
|
+
from .change_data_record_history_service import get_change_data_record_history_service, ChangeDataRecordHistoryService
|
13
16
|
from .change_data_json_service import get_change_data_json_service, ChangeDataJsonService
|
17
|
+
from .change_data_json_history_service import get_change_data_json_history_service, ChangeDataJsonHistoryService
|
14
18
|
|
15
19
|
|
16
20
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
from watchmen_collector_kernel.storage.change_data_json_service import ChangeDataJsonShaper, ChangeDataJsonService
|
2
|
+
|
3
|
+
from watchmen_auth import PrincipalService
|
4
|
+
|
5
|
+
from watchmen_collector_kernel.model import ChangeDataJson
|
6
|
+
from watchmen_meta.common.storage_service import StorableId
|
7
|
+
from watchmen_model.common import Storable, ChangeJsonId
|
8
|
+
from watchmen_storage import EntityName, EntityShaper, TransactionalStorageSPI, SnowflakeGenerator
|
9
|
+
|
10
|
+
|
11
|
+
class ChangeDataJsonHistoryShaper(ChangeDataJsonShaper):
|
12
|
+
pass
|
13
|
+
|
14
|
+
|
15
|
+
CHANGE_DATA_JSON_HISTORY_TABLE = 'change_data_json_history'
|
16
|
+
CHANGE_DATA_JSON_HISTORY_ENTITY_SHAPER = ChangeDataJsonHistoryShaper()
|
17
|
+
|
18
|
+
|
19
|
+
class ChangeDataJsonHistoryService(ChangeDataJsonService):
|
20
|
+
|
21
|
+
def should_record_operation(self) -> bool:
|
22
|
+
return False
|
23
|
+
|
24
|
+
def get_entity_name(self) -> EntityName:
|
25
|
+
return CHANGE_DATA_JSON_HISTORY_TABLE
|
26
|
+
|
27
|
+
def get_entity_shaper(self) -> EntityShaper:
|
28
|
+
return CHANGE_DATA_JSON_HISTORY_ENTITY_SHAPER
|
29
|
+
|
30
|
+
# noinspection SpellCheckingInspection
|
31
|
+
def get_storable_id_column_name(self) -> EntityName:
|
32
|
+
return 'change_json_id'
|
33
|
+
|
34
|
+
def get_storable_id(self, storable: ChangeDataJson) -> StorableId:
|
35
|
+
# noinspection PyTypeChecker
|
36
|
+
return storable.changeJsonId
|
37
|
+
|
38
|
+
# noinspection SpellCheckingInspection
|
39
|
+
def set_storable_id(self, storable: ChangeDataJson, storable_id: ChangeJsonId) -> Storable:
|
40
|
+
storable.changeRecordId = storable_id
|
41
|
+
return storable
|
42
|
+
|
43
|
+
|
44
|
+
def get_change_data_json_history_service(storage: TransactionalStorageSPI,
|
45
|
+
snowflake_generator: SnowflakeGenerator,
|
46
|
+
principal_service: PrincipalService
|
47
|
+
) -> ChangeDataJsonHistoryService:
|
48
|
+
return ChangeDataJsonHistoryService(storage, snowflake_generator, principal_service)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
from typing import List, Dict, Any, Optional
|
2
2
|
|
3
3
|
from watchmen_auth import PrincipalService
|
4
|
-
from watchmen_collector_kernel.common import IS_POSTED, CHANGE_JSON_ID, TENANT_ID, MODEL_TRIGGER_ID
|
4
|
+
from watchmen_collector_kernel.common import IS_POSTED, CHANGE_JSON_ID, TENANT_ID, MODEL_TRIGGER_ID, ask_partial_size
|
5
5
|
from watchmen_collector_kernel.model import ChangeDataJson
|
6
6
|
from watchmen_meta.common import TupleService, TupleShaper
|
7
7
|
from watchmen_meta.common.storage_service import StorableId
|
8
|
-
from watchmen_model.common import Storable, ChangeJsonId
|
8
|
+
from watchmen_model.common import Storable, ChangeJsonId, Pageable
|
9
9
|
from watchmen_storage import EntityName, EntityRow, EntityShaper, TransactionalStorageSPI, SnowflakeGenerator, \
|
10
10
|
ColumnNameLiteral, EntityCriteriaExpression, EntityStraightValuesFinder, EntityStraightColumn, EntitySortColumn, \
|
11
11
|
EntitySortMethod
|
@@ -24,6 +24,7 @@ class ChangeDataJsonShaper(EntityShaper):
|
|
24
24
|
'content': entity.content,
|
25
25
|
'depend_on': entity.dependOn,
|
26
26
|
'is_posted': entity.isPosted,
|
27
|
+
'result': entity.result,
|
27
28
|
'task_id': entity.taskId,
|
28
29
|
'table_trigger_id': entity.tableTriggerId,
|
29
30
|
'model_trigger_id': entity.modelTriggerId,
|
@@ -43,6 +44,7 @@ class ChangeDataJsonShaper(EntityShaper):
|
|
43
44
|
content=row.get('content'),
|
44
45
|
dependOn=row.get('depend_on'),
|
45
46
|
isPosted=row.get('is_posted'),
|
47
|
+
result=row.get('result'),
|
46
48
|
taskId=row.get('task_id'),
|
47
49
|
tableTriggerId=row.get('table_trigger_id'),
|
48
50
|
modelTriggerId=row.get('model_trigger_id'),
|
@@ -104,6 +106,35 @@ class ChangeDataJsonService(TupleService):
|
|
104
106
|
finally:
|
105
107
|
self.close_transaction()
|
106
108
|
|
109
|
+
def find_partial_json(self, model_trigger_id: int) -> List[ChangeDataJson]:
|
110
|
+
self.begin_transaction()
|
111
|
+
try:
|
112
|
+
return self.storage.page(self.get_entity_pager(
|
113
|
+
criteria=[
|
114
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=IS_POSTED), right=False),
|
115
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=MODEL_TRIGGER_ID),
|
116
|
+
right=model_trigger_id)
|
117
|
+
],
|
118
|
+
pageable=Pageable(pageNumber=1, pageSize=ask_partial_size())
|
119
|
+
)).data
|
120
|
+
finally:
|
121
|
+
self.close_transaction()
|
122
|
+
|
123
|
+
def is_existed(self, change_json: ChangeDataJson) -> bool:
|
124
|
+
self.begin_transaction()
|
125
|
+
try:
|
126
|
+
return self.storage.exists(self.get_entity_finder(
|
127
|
+
criteria=[
|
128
|
+
EntityCriteriaExpression(
|
129
|
+
left=ColumnNameLiteral(
|
130
|
+
columnName=self.get_storable_id_column_name()
|
131
|
+
),
|
132
|
+
right=change_json.changeJsonId)
|
133
|
+
]
|
134
|
+
))
|
135
|
+
finally:
|
136
|
+
self.close_transaction()
|
137
|
+
|
107
138
|
def find_json_by_id(self, change_json_id: str) -> ChangeDataJson:
|
108
139
|
self.begin_transaction()
|
109
140
|
try:
|
@@ -112,7 +143,7 @@ class ChangeDataJsonService(TupleService):
|
|
112
143
|
finally:
|
113
144
|
self.close_transaction()
|
114
145
|
|
115
|
-
def
|
146
|
+
def find_by_resource_id(self, resource_id: str) -> Optional[ChangeDataJson]:
|
116
147
|
try:
|
117
148
|
self.storage.connect()
|
118
149
|
return self.storage.find_one(self.get_entity_finder(
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from .change_data_record_service import ChangeDataRecordShaper, ChangeDataRecordService
|
2
|
+
from watchmen_auth import PrincipalService
|
3
|
+
from watchmen_collector_kernel.model import ChangeDataRecordHistory
|
4
|
+
from watchmen_meta.common.storage_service import StorableId
|
5
|
+
from watchmen_model.common import Storable, ChangeRecordId
|
6
|
+
from watchmen_storage import EntityName, EntityShaper, TransactionalStorageSPI, SnowflakeGenerator
|
7
|
+
|
8
|
+
|
9
|
+
class ChangeDataRecordHistoryShaper(ChangeDataRecordShaper):
|
10
|
+
pass
|
11
|
+
|
12
|
+
|
13
|
+
CHANGE_DATA_RECORD_HISTORY_TABLE = 'change_data_record_history'
|
14
|
+
CHANGE_DATA_RECORD_HISTORY_ENTITY_SHAPER = ChangeDataRecordHistoryShaper()
|
15
|
+
|
16
|
+
|
17
|
+
class ChangeDataRecordHistoryService(ChangeDataRecordService):
|
18
|
+
|
19
|
+
def should_record_operation(self) -> bool:
|
20
|
+
return False
|
21
|
+
|
22
|
+
def get_entity_name(self) -> EntityName:
|
23
|
+
return CHANGE_DATA_RECORD_HISTORY_TABLE
|
24
|
+
|
25
|
+
def get_entity_shaper(self) -> EntityShaper:
|
26
|
+
return CHANGE_DATA_RECORD_HISTORY_ENTITY_SHAPER
|
27
|
+
|
28
|
+
# noinspection SpellCheckingInspection
|
29
|
+
def get_storable_id_column_name(self) -> EntityName:
|
30
|
+
return 'change_record_id'
|
31
|
+
|
32
|
+
# noinspection SpellCheckingInspection
|
33
|
+
def get_storable_id(self, storable: ChangeDataRecordHistory) -> StorableId:
|
34
|
+
# noinspection PyTypeChecker
|
35
|
+
return storable.changeRecordId
|
36
|
+
|
37
|
+
# noinspection SpellCheckingInspection
|
38
|
+
def set_storable_id(self, storable: ChangeDataRecordHistory, storable_id: ChangeRecordId) -> Storable:
|
39
|
+
storable.changeRecordId = storable_id
|
40
|
+
return storable
|
41
|
+
|
42
|
+
|
43
|
+
def get_change_data_record_history_service(storage: TransactionalStorageSPI,
|
44
|
+
snowflake_generator: SnowflakeGenerator,
|
45
|
+
principal_service: PrincipalService
|
46
|
+
) -> ChangeDataRecordService:
|
47
|
+
return ChangeDataRecordHistoryService(storage, snowflake_generator, principal_service)
|
@@ -1,13 +1,14 @@
|
|
1
1
|
from typing import List, Optional, Dict
|
2
2
|
|
3
3
|
from watchmen_auth import PrincipalService
|
4
|
-
from watchmen_collector_kernel.common import CHANGE_RECORD_ID, TENANT_ID, IS_MERGED
|
4
|
+
from watchmen_collector_kernel.common import CHANGE_RECORD_ID, TENANT_ID, IS_MERGED, ask_partial_size
|
5
5
|
from watchmen_collector_kernel.model import ChangeDataRecord
|
6
6
|
from watchmen_meta.common import TupleService, TupleShaper
|
7
7
|
from watchmen_meta.common.storage_service import StorableId
|
8
|
-
from watchmen_model.common import Storable, ChangeRecordId
|
8
|
+
from watchmen_model.common import Storable, ChangeRecordId, Pageable
|
9
9
|
from watchmen_storage import EntityName, EntityRow, EntityShaper, TransactionalStorageSPI, SnowflakeGenerator, \
|
10
|
-
EntityCriteriaExpression, ColumnNameLiteral, EntityStraightValuesFinder, EntityStraightColumn, EntityColumnType
|
10
|
+
EntityCriteriaExpression, ColumnNameLiteral, EntityStraightValuesFinder, EntityStraightColumn, EntityColumnType, \
|
11
|
+
EntityPager
|
11
12
|
from watchmen_utilities import ArrayHelper
|
12
13
|
|
13
14
|
|
@@ -110,19 +111,34 @@ class ChangeDataRecordService(TupleService):
|
|
110
111
|
finally:
|
111
112
|
self.close_transaction()
|
112
113
|
|
113
|
-
def
|
114
|
+
def find_partial_records(self) -> List[ChangeDataRecord]:
|
114
115
|
self.begin_transaction()
|
115
116
|
try:
|
116
|
-
|
117
|
-
return self.storage.count(self.get_entity_finder(
|
117
|
+
return self.storage.page(self.get_entity_pager(
|
118
118
|
criteria=[
|
119
119
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName=IS_MERGED), right=False)
|
120
|
+
],
|
121
|
+
pageable=Pageable(pageNumber=1, pageSize=ask_partial_size())
|
122
|
+
)).data
|
123
|
+
finally:
|
124
|
+
self.close_transaction()
|
125
|
+
|
126
|
+
def is_existed(self, change_record: ChangeDataRecord) -> bool:
|
127
|
+
self.begin_transaction()
|
128
|
+
try:
|
129
|
+
return self.storage.exists(self.get_entity_finder(
|
130
|
+
criteria=[
|
131
|
+
EntityCriteriaExpression(
|
132
|
+
left=ColumnNameLiteral(
|
133
|
+
columnName=self.get_storable_id_column_name()
|
134
|
+
),
|
135
|
+
right=change_record.changeRecordId)
|
120
136
|
]
|
121
137
|
))
|
122
138
|
finally:
|
123
139
|
self.close_transaction()
|
124
140
|
|
125
|
-
def find_change_record_by_id(self, change_record_id: ChangeRecordId) -> ChangeDataRecord:
|
141
|
+
def find_change_record_by_id(self, change_record_id: ChangeRecordId) -> Optional[ChangeDataRecord]:
|
126
142
|
self.begin_transaction()
|
127
143
|
try:
|
128
144
|
# noinspection PyTypeChecker
|
@@ -143,8 +159,8 @@ class ChangeDataRecordService(TupleService):
|
|
143
159
|
right=table_trigger_id)
|
144
160
|
],
|
145
161
|
straightColumns=[EntityStraightColumn(columnName='data_id', columnType=EntityColumnType.JSON)]
|
146
|
-
)
|
147
162
|
)
|
163
|
+
)
|
148
164
|
return ArrayHelper(result).map(lambda x: x.get('data_id')).to_list()
|
149
165
|
finally:
|
150
166
|
self.close_transaction()
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from .scheduled_task_service import ScheduledTaskShaper, ScheduledTaskService
|
2
|
+
|
3
|
+
from watchmen_auth import PrincipalService
|
4
|
+
from watchmen_collector_kernel.model import ScheduledTask
|
5
|
+
from watchmen_meta.common.storage_service import StorableId
|
6
|
+
from watchmen_model.common import Storable, ScheduledTaskId
|
7
|
+
from watchmen_storage import EntityName, EntityShaper, TransactionalStorageSPI, SnowflakeGenerator
|
8
|
+
|
9
|
+
|
10
|
+
class ScheduledTaskHistoryShaper(ScheduledTaskShaper):
|
11
|
+
pass
|
12
|
+
|
13
|
+
|
14
|
+
SCHEDULED_TASK_HISTORY_TABLE = 'scheduled_task_history'
|
15
|
+
SCHEDULED_TASK_HISTORY_ENTITY_SHAPER = ScheduledTaskHistoryShaper()
|
16
|
+
|
17
|
+
|
18
|
+
class ScheduledTaskHistoryService(ScheduledTaskService):
|
19
|
+
|
20
|
+
def should_record_operation(self) -> bool:
|
21
|
+
return False
|
22
|
+
|
23
|
+
def get_entity_name(self) -> EntityName:
|
24
|
+
return SCHEDULED_TASK_HISTORY_TABLE
|
25
|
+
|
26
|
+
def get_entity_shaper(self) -> EntityShaper:
|
27
|
+
return SCHEDULED_TASK_HISTORY_ENTITY_SHAPER
|
28
|
+
|
29
|
+
def get_storable_id_column_name(self) -> EntityName:
|
30
|
+
return 'task_id'
|
31
|
+
|
32
|
+
def get_storable_id(self, storable: ScheduledTask) -> StorableId:
|
33
|
+
return storable.taskId
|
34
|
+
|
35
|
+
def set_storable_id(
|
36
|
+
self, storable: ScheduledTask, storable_id: ScheduledTaskId) -> Storable:
|
37
|
+
storable.taskId = storable_id
|
38
|
+
return storable
|
39
|
+
|
40
|
+
|
41
|
+
def get_scheduled_task_history_service(storage: TransactionalStorageSPI,
|
42
|
+
snowflake_generator: SnowflakeGenerator,
|
43
|
+
principal_service: PrincipalService
|
44
|
+
) -> ScheduledTaskHistoryService:
|
45
|
+
return ScheduledTaskHistoryService(storage, snowflake_generator, principal_service)
|
@@ -1,17 +1,35 @@
|
|
1
1
|
from typing import Optional, List, Any, Dict
|
2
2
|
|
3
|
+
from watchmen_collector_kernel.common import ask_partial_size
|
4
|
+
from watchmen_utilities import ArrayHelper
|
5
|
+
|
6
|
+
from watchmen_collector_kernel.model.scheduled_task import Dependence
|
7
|
+
|
3
8
|
from watchmen_auth import PrincipalService
|
4
9
|
from watchmen_collector_kernel.model import ScheduledTask
|
5
10
|
from watchmen_meta.common import TupleService, TupleShaper
|
6
11
|
from watchmen_meta.common.storage_service import StorableId
|
7
|
-
from watchmen_model.common import Storable, ScheduledTaskId
|
12
|
+
from watchmen_model.common import Storable, ScheduledTaskId, Pageable
|
8
13
|
from watchmen_storage import EntityName, EntityRow, EntityShaper, TransactionalStorageSPI, \
|
9
14
|
EntityCriteriaExpression, ColumnNameLiteral, SnowflakeGenerator, EntitySortColumn, EntitySortMethod, \
|
10
|
-
EntityCriteriaJoint,
|
11
|
-
EntityCriteriaOperator
|
15
|
+
EntityCriteriaJoint, EntityStraightValuesFinder, EntityStraightColumn
|
12
16
|
|
13
17
|
|
14
18
|
class ScheduledTaskShaper(EntityShaper):
|
19
|
+
|
20
|
+
@staticmethod
|
21
|
+
def serialize_dependence(dependence: Dependence) -> dict:
|
22
|
+
if isinstance(dependence, dict):
|
23
|
+
return dependence
|
24
|
+
else:
|
25
|
+
return dependence.dict()
|
26
|
+
|
27
|
+
@staticmethod
|
28
|
+
def serialize_depend_on(depend_on: Optional[List[Dependence]]) -> Optional[list]:
|
29
|
+
if depend_on is None:
|
30
|
+
return None
|
31
|
+
return ArrayHelper(depend_on).map(lambda x: ScheduledTaskShaper.serialize_dependence(x)).to_list()
|
32
|
+
|
15
33
|
def serialize(self, entity: ScheduledTask) -> EntityRow:
|
16
34
|
return TupleShaper.serialize_tenant_based(entity, {
|
17
35
|
'task_id': entity.taskId,
|
@@ -20,10 +38,10 @@ class ScheduledTaskShaper(EntityShaper):
|
|
20
38
|
'content': entity.content,
|
21
39
|
'model_name': entity.modelName,
|
22
40
|
'object_id': entity.objectId,
|
23
|
-
'depend_on': entity.dependOn,
|
41
|
+
'depend_on': ScheduledTaskShaper.serialize_depend_on(entity.dependOn),
|
24
42
|
'parent_task_id': entity.parentTaskId,
|
25
43
|
'tenant_id': entity.tenantId,
|
26
|
-
'
|
44
|
+
'is_finished': entity.isFinished,
|
27
45
|
'result': entity.result
|
28
46
|
})
|
29
47
|
|
@@ -39,7 +57,7 @@ class ScheduledTaskShaper(EntityShaper):
|
|
39
57
|
dependOn=row.get('depend_on'),
|
40
58
|
parentTaskId=row.get('parent_task_id'),
|
41
59
|
tenantId=row.get('tenant_id'),
|
42
|
-
|
60
|
+
isFinished=row.get('is_finished'),
|
43
61
|
result=row.get('result')
|
44
62
|
))
|
45
63
|
|
@@ -107,7 +125,7 @@ class ScheduledTaskService(TupleService):
|
|
107
125
|
criteria=[EntityCriteriaJoint(
|
108
126
|
children=[
|
109
127
|
EntityCriteriaExpression(
|
110
|
-
left=ColumnNameLiteral(columnName='
|
128
|
+
left=ColumnNameLiteral(columnName='is_finished'), right=False)
|
111
129
|
]
|
112
130
|
)],
|
113
131
|
straightColumns=[EntityStraightColumn(columnName='task_id'),
|
@@ -118,13 +136,43 @@ class ScheduledTaskService(TupleService):
|
|
118
136
|
finally:
|
119
137
|
self.close_transaction()
|
120
138
|
|
139
|
+
def find_partial_tasks(self) -> List[ScheduledTask]:
|
140
|
+
self.begin_transaction()
|
141
|
+
try:
|
142
|
+
return self.storage.page(self.get_entity_pager(
|
143
|
+
criteria=[
|
144
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='is_finished'), right=False)
|
145
|
+
],
|
146
|
+
pageable=Pageable(pageNumber=1, pageSize=ask_partial_size())
|
147
|
+
)).data
|
148
|
+
finally:
|
149
|
+
self.close_transaction()
|
150
|
+
|
151
|
+
def is_existed(self, task: ScheduledTask) -> bool:
|
152
|
+
self.begin_transaction()
|
153
|
+
try:
|
154
|
+
return self.storage.exists(self.get_entity_finder(
|
155
|
+
criteria=[
|
156
|
+
EntityCriteriaExpression(
|
157
|
+
left=ColumnNameLiteral(
|
158
|
+
columnName=self.get_storable_id_column_name()
|
159
|
+
),
|
160
|
+
right=task.taskId)
|
161
|
+
]
|
162
|
+
))
|
163
|
+
finally:
|
164
|
+
self.close_transaction()
|
165
|
+
|
121
166
|
def find_by_resource_id(self, resource_id: str) -> List[Dict[str, Any]]:
|
122
167
|
self.begin_transaction()
|
123
168
|
try:
|
124
169
|
return self.storage.find_straight_values(EntityStraightValuesFinder(
|
125
170
|
name=self.get_entity_name(),
|
126
|
-
criteria=[
|
127
|
-
|
171
|
+
criteria=[
|
172
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='resource_id'), right=resource_id)],
|
173
|
+
straightColumns=[EntityStraightColumn(columnName='task_id'),
|
174
|
+
EntityStraightColumn(columnName='resource_id'),
|
175
|
+
EntityStraightColumn(columnName='tenant_id')]
|
128
176
|
))
|
129
177
|
finally:
|
130
178
|
self.close_transaction()
|
@@ -139,8 +187,8 @@ class ScheduledTaskService(TupleService):
|
|
139
187
|
right=model_name),
|
140
188
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='object_id'),
|
141
189
|
right=object_id),
|
142
|
-
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='
|
143
|
-
right=
|
190
|
+
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='is_finished'),
|
191
|
+
right=False),
|
144
192
|
EntityCriteriaExpression(left=ColumnNameLiteral(columnName='tenant_id'),
|
145
193
|
right=tenant_id)
|
146
194
|
]
|
@@ -148,6 +196,7 @@ class ScheduledTaskService(TupleService):
|
|
148
196
|
finally:
|
149
197
|
self.close_transaction()
|
150
198
|
|
199
|
+
|
151
200
|
def get_scheduled_task_service(storage: TransactionalStorageSPI,
|
152
201
|
snowflake_generator: SnowflakeGenerator,
|
153
202
|
principal_service: PrincipalService
|
@@ -1,28 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: watchmen-collector-kernel
|
3
|
-
Version: 16.4.8
|
4
|
-
Summary:
|
5
|
-
License: MIT
|
6
|
-
Author: botlikes
|
7
|
-
Author-email: 75356972+botlikes456@users.noreply.github.com
|
8
|
-
Requires-Python: >=3.9,<4.0
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
14
|
-
Provides-Extra: mongodb
|
15
|
-
Provides-Extra: mssql
|
16
|
-
Provides-Extra: mysql
|
17
|
-
Provides-Extra: oracle
|
18
|
-
Provides-Extra: oss
|
19
|
-
Provides-Extra: postgresql
|
20
|
-
Provides-Extra: s3
|
21
|
-
Requires-Dist: watchmen-data-kernel (==16.4.8)
|
22
|
-
Requires-Dist: watchmen-storage-mongodb (==16.4.8) ; extra == "mongodb"
|
23
|
-
Requires-Dist: watchmen-storage-mssql (==16.4.8) ; extra == "mssql"
|
24
|
-
Requires-Dist: watchmen-storage-mysql (==16.4.8) ; extra == "mysql"
|
25
|
-
Requires-Dist: watchmen-storage-oracle (==16.4.8) ; extra == "oracle"
|
26
|
-
Requires-Dist: watchmen-storage-oss (==16.4.8) ; extra == "oss"
|
27
|
-
Requires-Dist: watchmen-storage-postgresql (==16.4.8) ; extra == "postgresql"
|
28
|
-
Requires-Dist: watchmen-storage-s3 (==16.4.8) ; extra == "s3"
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
from setuptools import setup
|
3
|
-
|
4
|
-
package_dir = \
|
5
|
-
{'': 'src'}
|
6
|
-
|
7
|
-
packages = \
|
8
|
-
['watchmen_collector_kernel',
|
9
|
-
'watchmen_collector_kernel.common',
|
10
|
-
'watchmen_collector_kernel.model',
|
11
|
-
'watchmen_collector_kernel.service',
|
12
|
-
'watchmen_collector_kernel.storage']
|
13
|
-
|
14
|
-
package_data = \
|
15
|
-
{'': ['*']}
|
16
|
-
|
17
|
-
install_requires = \
|
18
|
-
['watchmen-data-kernel==16.4.8']
|
19
|
-
|
20
|
-
extras_require = \
|
21
|
-
{'mongodb': ['watchmen-storage-mongodb==16.4.8'],
|
22
|
-
'mssql': ['watchmen-storage-mssql==16.4.8'],
|
23
|
-
'mysql': ['watchmen-storage-mysql==16.4.8'],
|
24
|
-
'oracle': ['watchmen-storage-oracle==16.4.8'],
|
25
|
-
'oss': ['watchmen-storage-oss==16.4.8'],
|
26
|
-
'postgresql': ['watchmen-storage-postgresql==16.4.8'],
|
27
|
-
's3': ['watchmen-storage-s3==16.4.8']}
|
28
|
-
|
29
|
-
setup_kwargs = {
|
30
|
-
'name': 'watchmen-collector-kernel',
|
31
|
-
'version': '16.4.8',
|
32
|
-
'description': '',
|
33
|
-
'long_description': 'None',
|
34
|
-
'author': 'botlikes',
|
35
|
-
'author_email': '75356972+botlikes456@users.noreply.github.com',
|
36
|
-
'maintainer': 'None',
|
37
|
-
'maintainer_email': 'None',
|
38
|
-
'url': 'None',
|
39
|
-
'package_dir': package_dir,
|
40
|
-
'packages': packages,
|
41
|
-
'package_data': package_data,
|
42
|
-
'install_requires': install_requires,
|
43
|
-
'extras_require': extras_require,
|
44
|
-
'python_requires': '>=3.9,<4.0',
|
45
|
-
}
|
46
|
-
|
47
|
-
|
48
|
-
setup(**setup_kwargs)
|
@@ -1,36 +0,0 @@
|
|
1
|
-
from typing import Dict, List
|
2
|
-
|
3
|
-
from watchmen_model.common import TenantBasedTuple, ScheduledTaskId, Storable
|
4
|
-
from pydantic import BaseModel
|
5
|
-
from enum import Enum, IntEnum
|
6
|
-
|
7
|
-
|
8
|
-
class Result(str, Enum):
|
9
|
-
DEPENDENCY_FAILED = "DEPENDENCY_FAILED"
|
10
|
-
PROCESS_TASK_SUCCESS = "PROCESS_TASK_SUCCESS"
|
11
|
-
PROCESS_TASK_FAILED = "PROCESS_TASK_FAILED"
|
12
|
-
|
13
|
-
|
14
|
-
class TaskStatus(IntEnum):
|
15
|
-
INITIAL = 0
|
16
|
-
SUCCESS = 1
|
17
|
-
FAILED = 2
|
18
|
-
|
19
|
-
|
20
|
-
class Dependence(Storable, BaseModel):
|
21
|
-
modelName: str
|
22
|
-
objectId: str
|
23
|
-
|
24
|
-
|
25
|
-
class ScheduledTask(TenantBasedTuple, BaseModel):
|
26
|
-
taskId: ScheduledTaskId
|
27
|
-
resourceId: str # global unique, monotonous increase
|
28
|
-
topicCode: str
|
29
|
-
content: Dict
|
30
|
-
modelName: str
|
31
|
-
objectId: str
|
32
|
-
dependOn: List[Dependence]
|
33
|
-
parentTaskId: List[int]
|
34
|
-
status: TaskStatus
|
35
|
-
result: Dict
|
36
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|