1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- class Const:
- # task status
- TASK_INIT_STATUS = 0
- TASK_PROCESSING_STATUS = 1
- TASK_SUCCESS_STATUS = 2
- TASK_FAILED_STATUS = 99
- # DEFAULT
- DEFAULT_TIMEOUT = 1800
- # duration
- CHECK_KIMI_BALANCE_TIMEOUT = 20
- GET_OFF_VIDEO_TIMEOUT = 1800
- CHECK_VIDEO_AUDIT_TIMEOUT = 1800
- OUTSIDE_ARTICLE_MONITOR_TIMEOUT = 3 * 3600
- INNER_ARTICLE_MONITOR_TIMEOUT = 3600
- TITLE_REWRITE_TIMEOUT = 1800
- RECYCLE_DAILY_ARTICLE_TIMEOUT = 3600
- UPDATE_ROOT_SOURCE_ID_TIMEOUT = 3600
- CRAWLER_TOUTIAO_ARTICLES_TIMEOUT = 5 * 3600
- ARTICLE_POOL_COLD_START_TIMEOUT = 4 * 3600
- TASK_MAX_NUM = 5
- class TaskMapper(Const):
- def get_task_config(self, task_name) -> dict:
- match task_name:
- case "check_kimi_balance":
- expire_duration = self.CHECK_KIMI_BALANCE_TIMEOUT
- case "get_off_videos":
- expire_duration = self.GET_OFF_VIDEO_TIMEOUT
- case "check_publish_video_audit_status":
- expire_duration = self.CHECK_VIDEO_AUDIT_TIMEOUT
- case "outside_article_monitor":
- expire_duration = self.OUTSIDE_ARTICLE_MONITOR_TIMEOUT
- case "inner_article_monitor":
- expire_duration = self.INNER_ARTICLE_MONITOR_TIMEOUT
- case "title_rewrite":
- expire_duration = self.TITLE_REWRITE_TIMEOUT
- case "daily_publish_articles_recycle":
- expire_duration = self.RECYCLE_DAILY_ARTICLE_TIMEOUT
- case "update_root_source_id":
- expire_duration = self.UPDATE_ROOT_SOURCE_ID_TIMEOUT
- case "crawler_toutiao_articles":
- expire_duration = self.CRAWLER_TOUTIAO_ARTICLES_TIMEOUT
- case "article_pool_pool_cold_start":
- expire_duration = self.ARTICLE_POOL_COLD_START_TIMEOUT
- case _:
- expire_duration = self.DEFAULT_TIMEOUT
- return {"expire_duration": expire_duration, "task_max_num": self.TASK_MAX_NUM}
- __all__ = ["TaskMapper"]
|