Using for Debug, finding problem
Project description
1、介绍
本项目是对通用文件导出任务的抽象组件提取,通过使用本项目,可以简化通用文件导相关业务的开发。
2、使用方式
示例:
1、配置文件
[download_task]
dbHost=localhost
dbPort=3306
dbUser=root
dbPassword=12345678
dbName=cti
redisHost=localhost
redisPort=6379
redisDb=0
2、任务分发调度及状态管理
from duyan_download_task import DownloadTaskScheduler
def test_scheduler():
scheduler = DownloadTaskScheduler('config.ini', 'download_task_scheduler')
scheduler.start()
if __name__ == '__main__':
test_scheduler()
3、自定义导出业务逻辑
import json
from duyan_download_task import DownloadTaskBase, SubTypeInfo
from duyan_download_task.model import DownloadTaskMain, DownloadItem
class DemoTask(DownloadTaskBase):
def __init__(self, task_info: SubTypeInfo, config_path: str, logger_name: str):
super().__init__(task_info, config_path, logger_name)
def get_validated_data_params(self, task_item_id: int, data: str) -> dict or None:
self._logger.info(f"校验数据:[ID:{task_item_id}],data:{data}")
return json.loads(data)
def export(self, task_item: DownloadItem, data_obj: dict) -> tuple:
self._logger.info(f"校验导出:[item:{data_obj}],data:{data_obj}")
return None, None, None
def split_task(self, task: DownloadTaskMain) -> list:
pass
def task_test():
info = SubTypeInfo(task_name='DemoTask', type=10, sub_type=15, queue_key='demo_task_queue', is_multi_task=False)
task = DemoTask(info, 'config.ini', 'demo_task')
task.start()
if __name__ == '__main__':
task_test()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
duyan-download-task-0.0.2.tar.gz
(14.4 kB
view hashes)
Built Distribution
Close
Hashes for duyan-download-task-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c498bc27eb435ed95595a8607b12b18ef1c7121e93a15efc94dea25c3b245cd6 |
|
MD5 | c6e0acc9173805c7902cfa29a4692293 |
|
BLAKE2b-256 | cf4f2718bd00b115413939768b4312c0f4623c3f352cd2434e50f0233de9c9e5 |
Close
Hashes for duyan_download_task-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 272652741368c4f8973aab5162b52396ad881f0545cf2cff60cf46c4d2e9d609 |
|
MD5 | 2a7e1d42bf5b2f7934756e5828e12cc7 |
|
BLAKE2b-256 | 9ace30394fa5dde736d92d0a09369a94e79ee8ab70a956e3a930b3615cc7237d |