Skip to content

Commit

Permalink
feat: 超大订阅方案 (closed #2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyalt committed Dec 10, 2024
1 parent e01e2eb commit e38ab65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions apps/backend/components/collections/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ class BaseService(Service, LogMixin, DBHelperMixin, PollingTimeoutMixin):
failed_subscription_instance_id_reason_map: Optional[Dict[int, Any]] = None
# 日志制作类实例
log_maker: Optional[LogMaker] = None
# is_multi_paralle_gateway: bool = False

def __init__(self, *args, **kwargs):
self.failed_subscription_instance_id_reason_map: Dict = {}
Expand Down Expand Up @@ -686,7 +685,9 @@ def inputs_format(self):
),
Service.InputItem(name="subscription_step_id", key="subscription_step_id", type="int", required=True),
Service.InputItem(name="blueking_language", key="blueking_language", type="str", required=True),
Service.InputItem(name="is_multi_paralle_gateway", key="is_multi_paralle_gateway", type="bool", required=True),
Service.InputItem(
name="is_multi_paralle_gateway", key="is_multi_paralle_gateway", type="bool", required=True
),
]

def outputs_format(self):
Expand Down
13 changes: 8 additions & 5 deletions apps/backend/subscription/steps/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def handle_uninstall_instances(
def handle_new_add_instances(
self,
install_action: str,
instances: RedisDict,
instances: Union[RedisDict, Dict[str, Dict]],
instance_actions: Dict[str, str],
bk_host_id__host_map: Dict[int, models.Host],
group_id__host_key__proc_status_map: Dict[str, Dict[str, models.ProcessStatus]],
Expand Down Expand Up @@ -441,7 +441,7 @@ def handle_exceed_max_retry_times_instances(

def handle_manual_op_instances(
self,
instances: RedisDict,
instances: Union[RedisDict, Dict[str, Dict]],
instance_actions: Dict[str, str],
auto_trigger: bool,
push_migrate_reason_func: Callable,
Expand Down Expand Up @@ -492,7 +492,10 @@ def handle_manual_op_instances(
)

def handle_not_change_instances(
self, instances: RedisDict, migrate_reasons: Dict[str, Dict], push_migrate_reason_func: Callable
self,
instances: Union[RedisDict, Dict[str, Dict]],
migrate_reasons: Dict[str, Dict],
push_migrate_reason_func: Callable,
):
"""
处理无需变更实例,请在最后调用该钩子
Expand Down Expand Up @@ -584,7 +587,7 @@ def handle_check_and_skip_instances(
instance_actions: Dict[str, str],
push_migrate_reason_func: Callable,
bk_host_id__host_map: Dict[int, models.Host],
instances: RedisDict,
instances: Union[RedisDict, Dict[str, Dict]],
):
"""
插件状态及版本检查,确定是否执行安装
Expand Down Expand Up @@ -714,7 +717,7 @@ def get_action_dict(self) -> Dict[str, str]:

def make_instances_migrate_actions(
self,
instances: RedisDict,
instances: Union[RedisDict, Dict[str, Dict]],
auto_trigger: bool = False,
preview_only: bool = False,
**kwargs,
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/subscription/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def wrapper(subscription: models.Subscription, subscription_task: models.Subscri
def create_task(
subscription: models.Subscription,
subscription_task: models.SubscriptionTask,
instances: RedisDict,
instances: Union[RedisDict, Dict[str, Dict]],
instance_actions: Dict[str, Dict[str, str]],
preview_only: bool = False,
data_backend: str = None,
Expand Down

0 comments on commit e38ab65

Please sign in to comment.