Skip to content

Commit

Permalink
feat: 优化进程启动时间为可配置项 (closed TencentBlueKing#2178)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huayeaaa committed May 7, 2024
1 parent 1210116 commit 778aa7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/backend/components/collections/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,10 @@ def _execute(self, data, parent_data, common_data: PluginCommonData):

host_id__resource_policy_map = self.get_resource_policy(common_data.bk_host_ids, plugin.name)
proc_operate_req = []
start_check_secs = models.GlobalSettings.get_config(
models.GlobalSettings.KeyEnum.PLUGIN_PROC_START_CHECK_SECS.value,
default=constants.DEFAULT_PLUGIN_PROC_START_CHECK_SECS,
)
for process_status in process_statuses:
bk_host_id = process_status.bk_host_id
host = host_id_obj_map.get(bk_host_id)
Expand Down Expand Up @@ -1206,7 +1210,7 @@ def _execute(self, data, parent_data, common_data: PluginCommonData):
"alive_monitor_policy": {
# 托管类型,0为周期执行进程,1为常驻进程,2为单次执行进程, 1.0沿用1
"auto_type": plugin.auto_type if gse_version == GseVersion.V2.value else 1,
"start_check_secs": 9,
"start_check_secs": start_check_secs,
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions apps/node_man/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ def _get_member__alias_map(cls) -> Dict[Enum, str]:

QUERY_BIZ_LENS = 200

# 默认插件进程启动检查时间
DEFAULT_PLUGIN_PROC_START_CHECK_SECS = 9


class ProxyFileFromType(Enum):
"""Proxy上传文件名称来源"""
Expand Down
2 changes: 2 additions & 0 deletions apps/node_man/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class KeyEnum(Enum):
SUBSCRIPTION_UPDATE_TASK_QUEUE = "SUBSCRIPTION_UPDATE_TASK_QUEUE"
# JOB任务策略
JOB_TASK_POLICY = "JOB_TASK_POLICY"
# 插件进程启动检查时间
PLUGIN_PROC_START_CHECK_SECS = "PLUGIN_PROC_START_CHECK_SECS"

key = models.CharField(_("键"), max_length=255, db_index=True, primary_key=True)
v_json = JSONField(_("值"))
Expand Down

0 comments on commit 778aa7f

Please sign in to comment.