From 3ae952e79a5d0039e75c70af067cbe7430ff721a Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 8 Dec 2023 11:04:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=9C=80=E5=A4=A7=E8=BD=AE=E8=AF=A2=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=B0=83=E6=95=B4=E4=B8=BA=2010min=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=89=B9=E5=AE=9A=E6=8F=92=E4=BB=B6=E8=BD=AE?= =?UTF-8?q?=E8=AF=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.py | 12 +++++++----- env.py | 7 +++++++ .../components/collections/remote_plugin/v1_0_0.py | 10 +++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/config/default.py b/config/default.py index 9fc4d81721..5a8ad9f4eb 100644 --- a/config/default.py +++ b/config/default.py @@ -22,10 +22,10 @@ from blueapps.conf.log import get_logging_config_dict from blueapps.opentelemetry.utils import inject_logging_trace_info from django.utils.translation import ugettext_lazy as _ -from pipeline.celery.queues import ScalableQueues import env from gcloud.exceptions import ApiRequestError +from pipeline.celery.queues import ScalableQueues # 这里是默认的 INSTALLED_APPS,大部分情况下,不需要改动 # 如果你已经了解每个默认 APP 的作用,确实需要去掉某些 APP,请去掉下面的注释,然后修改 @@ -489,12 +489,11 @@ def _(s): PERIODIC_TASK_QUEUE_NAME = "periodic_task_queue" ScalableQueues.add(name=PERIODIC_TASK_QUEUE_NAME) -from pipeline.celery.settings import * # noqa -from pipeline.eri.celery import queues as eri_queues # noqa - from gcloud.contrib.cleaner import settings as cleaner_settings # noqa from gcloud.taskflow3.celery import settings as taskflow3_celery_settings # noqa from gcloud.taskflow3.domains.queues import PrepareAndStartTaskQueueResolver # noqa +from pipeline.celery.settings import * # noqa +from pipeline.eri.celery import queues as eri_queues # noqa API_TASK_QUEUE_NAME_V2 = "api" PERIODIC_TASK_QUEUE_NAME_V2 = "periodic_task" @@ -676,7 +675,6 @@ def monitor_report_config(): from bk_monitor_report import MonitorReporter # noqa from bk_monitor_report.contrib.celery import MonitorReportStep # noqa - from blueapps.core.celery import celery_app # noqa reporter = MonitorReporter( @@ -832,3 +830,7 @@ def check_engine_admin_permission(request, *args, **kwargs): # 任务列表过滤失败任务最大天数 TASK_LIST_STATUS_FILTER_DAYS = env.BKPAAS_TASK_LIST_STATUS_FILTER_DAYS + +# 第三方插件特殊轮询时间配置 +REMOTE_PLUGIN_FIX_INTERVAL_CODES = env.REMOTE_PLUGIN_FIX_INTERVAL_CODES +REMOTE_PLUGIN_FIX_INTERVAL = env.REMOTE_PLUGIN_FIX_INTERVAL diff --git a/env.py b/env.py index 85c1af5bf0..63ecf9ebbf 100644 --- a/env.py +++ b/env.py @@ -120,3 +120,10 @@ # 默认六个月 BKPAAS_TASK_LIST_STATUS_FILTER_DAYS = int(os.getenv("BKPAAS_TASK_LIST_STATUS_FILTER_DAYS", 180)) + +# 第三方插件特殊轮询时间配置 +REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR = os.getenv("BKAPP_REMOTE_PLUGIN_FIX_INTERVAL_CODES", "") +REMOTE_PLUGIN_FIX_INTERVAL_CODES = ( + REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR.split(",") if REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR else [] +) +REMOTE_PLUGIN_FIX_INTERVAL = int(os.getenv("BKAPP_REMOTE_PLUGIN_FIX_INTERVAL", 60)) diff --git a/pipeline_plugins/components/collections/remote_plugin/v1_0_0.py b/pipeline_plugins/components/collections/remote_plugin/v1_0_0.py index b10529fefd..74303ae89d 100644 --- a/pipeline_plugins/components/collections/remote_plugin/v1_0_0.py +++ b/pipeline_plugins/components/collections/remote_plugin/v1_0_0.py @@ -12,11 +12,12 @@ """ import logging +from django.conf import settings from django.utils.translation import ugettext_lazy as _ + from pipeline.component_framework.component import Component from pipeline.core.flow import AbstractIntervalGenerator, Service from pipeline.core.flow.io import StringItemSchema - from pipeline_plugins.components.utils.sites.open.utils import get_node_callback_url from plugin_service.conf import PLUGIN_LOGGER from plugin_service.exceptions import PluginServiceException @@ -43,8 +44,8 @@ def __init__(self): def next(self): super(StepIntervalGenerator, self).next() - # 最小 10s,最大 3600s 一次 - return self.fix_interval or (10 if self.count < 30 else min((self.count - 25) ** 2, 3600)) + # 最小 10s,最大 600s 一次 + return self.fix_interval or (10 if self.count < 30 else min((self.count - 25) ** 2, 600)) class RemotePluginService(Service): @@ -119,6 +120,9 @@ def schedule(self, data, parent_data, callback_data=None): plugin_code = data.get_one_of_inputs("plugin_code") trace_id = data.get_one_of_outputs("trace_id") + if plugin_code in settings.REMOTE_PLUGIN_FIX_INTERVAL_CODES: + self.interval.fix_interval = settings.REMOTE_PLUGIN_FIX_INTERVAL + try: plugin_client = PluginServiceApiClient(plugin_code) except PluginServiceException as e: From f8d80e6da469f7f5fb82d9d84503b485beca0e45 Mon Sep 17 00:00:00 2001 From: waylon <1158341873@qq.com> Date: Fri, 8 Dec 2023 11:07:20 +0800 Subject: [PATCH 2/2] docs: release V3.31.10 --- app.yml | 2 +- app_desc.yaml | 2 +- config/default.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.yml b/app.yml index a7c7bccdeb..d2e2f4c437 100644 --- a/app.yml +++ b/app.yml @@ -6,7 +6,7 @@ is_use_celery: True author: 蓝鲸智云 introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。 introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process. -version: 3.31.9 +version: 3.31.10 category: 运维工具 language_support: 中文 desktop: diff --git a/app_desc.yaml b/app_desc.yaml index 50e53d0478..ce8c26804c 100644 --- a/app_desc.yaml +++ b/app_desc.yaml @@ -1,5 +1,5 @@ spec_version: 2 -app_version: "3.31.9" +app_version: "3.31.10" app: region: default bk_app_code: bk_sops diff --git a/config/default.py b/config/default.py index 5a8ad9f4eb..4915289083 100644 --- a/config/default.py +++ b/config/default.py @@ -211,7 +211,7 @@ # mako模板中: # 如果静态资源修改了以后,上线前改这个版本号即可 -STATIC_VERSION = "3.31.9" +STATIC_VERSION = "3.31.10" DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S") STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]