提交 81a92cd5 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!144 定时任务执行无法触发的修复,针对获取源码包的维护人和维护级别信息的获取修复

Merge pull request !144 from gongzhengtang/master
......@@ -22,13 +22,18 @@ def _timed_task(app):
from .apps.lifecycle.function.download_yaml import update_pkg_info # pylint: disable=import-outside-toplevel
_readconfig = ReadConfig(system_config.SYS_CONFIG_PATH)
_hour = _readconfig.get_config('TIMEDTASK', 'hour')
if not _hour or not isinstance(_hour, int) or _hour < 0 or _hour > 23:
try:
_hour = int(_readconfig.get_config('TIMEDTASK', 'hour'))
_minute = int(_readconfig.get_config('TIMEDTASK', 'minute'))
except ValueError:
_hour = 3
_minute = _readconfig.get_config('TIMEDTASK', 'minute')
if not _hour or not isinstance(_hour, int) or _hour < 0 or _hour > 59:
_minute = 0
else:
if _hour < 0 or _hour > 23:
_hour = 3
if _minute < 0 or _minute > 59:
_minute = 0
app.apscheduler.add_job( # pylint: disable=no-member
func=update_pkg_info, id="update_package_data", trigger="cron", hour=_hour, minute=_minute)
app.apscheduler.add_job( # pylint: disable=no-member
......
......@@ -80,8 +80,8 @@ class ParseYaml():
if self._openeuler_advisor_exists_yaml():
self._save_to_database()
else:
msg = "The yaml information of the %s package has not been\
obtained yet" % self.pkg.name
msg = "The yaml information of the [%s] package has not been" \
"obtained yet" % self.pkg.name
self.base.log.logger.warning(msg)
def _get_yaml_content(self, url):
......@@ -118,15 +118,16 @@ class ParseYaml():
"""
self._parse_warehouse_info()
tags = self._yaml_content.get('git_tag', None)
self._parse_tags_content(tags)
if tags:
self._parse_tags_content(tags)
self.producer_consumer.put(copy.deepcopy(self.pkg))
if self.timed_task_open:
_maintainer = self._yaml_content.get('maintainer')
_maintainer = self._yaml_content.get('maintainers')
if _maintainer and isinstance(_maintainer, list):
self.pkg.maintainer = _maintainer[0]
self.pkg.maintainlevel = self._yaml_content.get('maintainlevel')
try:
self.producer_consumer.put(copy.deepcopy(self.pkg))
if self.timed_task_open and self.pkg.maintainer:
if self.timed_task_open:
@retry(stop_max_attempt_number=3, stop_max_delay=500)
def _save_maintainer_info():
with DBHelper(db_name="lifecycle") as database:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册