bk-plugin-framework 2.3.2rc2__tar.gz → 2.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/PKG-INFO +3 -2
  2. {bk_plugin_framework-2.3.2rc2/bk_plugin_framework/runtime → bk_plugin_framework-2.3.4/bk_plugin_framework}/__init__.py +0 -1
  3. bk_plugin_framework-2.3.4/bk_plugin_framework/__version__.py +12 -0
  4. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/constants.py +1 -1
  5. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/envs.py +3 -2
  6. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/hub/__init__.py +2 -2
  7. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/kit/__init__.py +6 -6
  8. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/kit/api.py +6 -6
  9. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/kit/authentication.py +1 -1
  10. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/kit/decorators.py +1 -1
  11. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/kit/plugin.py +7 -5
  12. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/metrics.py +7 -6
  13. {bk_plugin_framework-2.3.2rc2/bk_plugin_framework → bk_plugin_framework-2.3.4/bk_plugin_framework/runtime}/__init__.py +0 -1
  14. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callback/__init__.py +0 -1
  15. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callback/api.py +6 -6
  16. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callback/apps.py +0 -1
  17. {bk_plugin_framework-2.3.2rc2/bk_plugin_framework/runtime/callback/migrations → bk_plugin_framework-2.3.4/bk_plugin_framework/runtime/callback/celery}/__init__.py +0 -1
  18. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callback/celery/queues.py +0 -1
  19. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callback/celery/tasks.py +12 -7
  20. {bk_plugin_framework-2.3.2rc2/bk_plugin_framework/runtime/callback/celery → bk_plugin_framework-2.3.4/bk_plugin_framework/runtime/callback/migrations}/__init__.py +0 -1
  21. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/callbacker.py +0 -1
  22. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/executor.py +20 -11
  23. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/__init__.py +0 -1
  24. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/admin.py +0 -2
  25. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/apps.py +0 -1
  26. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/log.py +0 -1
  27. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/migrations/0001_initial.py +0 -1
  28. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/models.py +0 -2
  29. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/__init__.py +0 -1
  30. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/admin.py +0 -2
  31. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/apps.py +1 -2
  32. bk_plugin_framework-2.3.4/bk_plugin_framework/runtime/schedule/celery/__init__.py +10 -0
  33. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/celery/beat.py +0 -1
  34. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/celery/queues.py +0 -1
  35. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/celery/tasks.py +2 -3
  36. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/migrations/0001_initial.py +0 -2
  37. bk_plugin_framework-2.3.4/bk_plugin_framework/runtime/schedule/migrations/__init__.py +10 -0
  38. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/models.py +0 -1
  39. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/utils.py +2 -2
  40. bk_plugin_framework-2.3.4/bk_plugin_framework/serializers.py +19 -0
  41. bk_plugin_framework-2.3.4/bk_plugin_framework/services/__init__.py +10 -0
  42. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/__init__.py +0 -1
  43. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/admin.py +0 -1
  44. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/__init__.py +3 -4
  45. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/callback.py +34 -10
  46. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/detail.py +24 -13
  47. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/invoke.py +29 -16
  48. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/logs.py +24 -13
  49. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/meta.py +25 -14
  50. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/permissions.py +0 -1
  51. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/plugin_api_dispatch.py +34 -20
  52. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/schedule.py +30 -14
  53. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/api/serializers/__init__.py +0 -1
  54. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/apps.py +0 -2
  55. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/management/__init__.py +10 -0
  56. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/management/commands/__init__.py +10 -0
  57. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/management/commands/support-files/resources.yaml +437 -0
  58. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/management/commands/sync_apigateway_if_changed.py +237 -0
  59. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/middlewares.py +0 -1
  60. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/migrations/0001_initial.py +63 -0
  61. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/migrations/__init__.py +10 -0
  62. bk_plugin_framework-2.3.4/bk_plugin_framework/services/bpf_service/models.py +35 -0
  63. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/bpf_service/urls.py +9 -7
  64. bk_plugin_framework-2.3.4/bk_plugin_framework/services/debug_panel/management/commands/__init__.py +10 -0
  65. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/debug_panel/management/commands/rundebugserver.py +0 -1
  66. bk_plugin_framework-2.3.4/bk_plugin_framework/services/debug_panel/migrations/__init__.py +10 -0
  67. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/debug_panel/views.py +1 -3
  68. bk_plugin_framework-2.3.4/bk_plugin_framework/utils/__init__.py +10 -0
  69. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/utils/local.py +0 -1
  70. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/utils/log.py +0 -1
  71. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/utils/module_load.py +2 -3
  72. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/utils/validations.py +0 -2
  73. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/pyproject.toml +3 -2
  74. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/__version__.py +0 -13
  75. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/runtime/schedule/celery/__init__.py +0 -11
  76. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/runtime/schedule/migrations/__init__.py +0 -11
  77. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/__init__.py +0 -11
  78. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/__init__.py +0 -11
  79. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/commands/__init__.py +0 -11
  80. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/commands/data/api-definition.yml +0 -27
  81. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/commands/data/api-resources.yml +0 -146
  82. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/commands/data/api-strategy-cors.yml +0 -13
  83. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/management/commands/sync_plugin_apigw.py +0 -39
  84. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/bpf_service/migrations/__init__.py +0 -11
  85. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/debug_panel/management/commands/__init__.py +0 -11
  86. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/services/debug_panel/migrations/__init__.py +0 -11
  87. bk_plugin_framework-2.3.2rc2/bk_plugin_framework/utils/__init__.py +0 -11
  88. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/loghub/migrations/__init__.py +0 -0
  89. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/migrations/0002_schedule_finish_at.py +0 -0
  90. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/migrations/0003_auto_20210830_1945.py +0 -0
  91. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/migrations/0004_schedule_scheduling.py +0 -0
  92. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/runtime/schedule/migrations/0005_schedule_err.py +0 -0
  93. {bk_plugin_framework-2.3.2rc2 → bk_plugin_framework-2.3.4}/bk_plugin_framework/services/debug_panel/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bk-plugin-framework
3
- Version: 2.3.2rc2
3
+ Version: 2.3.4
4
4
  Summary: bk plugin python framework
5
5
  License: MIT
6
6
  Author: Your Name
@@ -15,7 +15,8 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Dist: apigw-manager[extra] (>=1.0.6,<4)
18
- Requires-Dist: bk-plugin-runtime (==2.1.1rc2)
18
+ Requires-Dist: bk-plugin-runtime (==2.1.3)
19
+ Requires-Dist: drf-spectacular (>=0.29.0,<0.30.0)
19
20
  Requires-Dist: jsonschema (>=2.5.0,<5.0.0)
20
21
  Requires-Dist: pydantic (>=1.0,<3)
21
22
  Requires-Dist: werkzeug (>=2.0.0,<4.0)
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -0,0 +1,12 @@
1
+ """
2
+ Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
3
+ Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
4
+ Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://opensource.org/licenses/MIT
7
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9
+ specific language governing permissions and limitations under the License.
10
+ """
11
+
12
+ __version__ = "2.3.4"
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,6 +8,7 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  from enum import Enum
13
13
 
14
14
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,15 +8,17 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
- import os
11
+
13
12
  import base64
14
13
  import hashlib
15
14
  import logging
15
+ import os
16
16
 
17
17
  try:
18
18
  from pydantic.v1 import BaseSettings
19
19
  except ImportError:
20
20
  from pydantic import BaseSettings
21
+
21
22
  from django.conf import settings as default_settings
22
23
 
23
24
  logger = logging.getLogger("bk_plugin")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,9 +9,10 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
12
+ import logging
13
13
  import os
14
14
  import typing
15
- import logging
15
+
16
16
  from bk_plugin_framework.utils.module_load import load_form_module_path
17
17
 
18
18
  logger = logging.getLogger("bk-plugin-framework")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -14,13 +13,14 @@ try:
14
13
  from pydantic.v1 import Field
15
14
  except ImportError:
16
15
  from pydantic import Field # noqa
16
+
17
17
  from bk_plugin_framework.kit.plugin import ( # noqa
18
- Plugin,
19
- InputsModel,
18
+ Callback,
20
19
  Context,
21
- OutputsModel,
22
20
  ContextRequire,
23
- State,
24
- Callback,
25
21
  FormModel,
22
+ InputsModel,
23
+ OutputsModel,
24
+ Plugin,
25
+ State,
26
26
  )
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,18 +8,19 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  import json
13
13
 
14
- from django.utils.decorators import method_decorator
14
+ from apigw_manager.apigw.decorators import apigw_require
15
+ from bkoauth import get_app_access_token
15
16
  from django.conf import settings as default_settings
16
- from rest_framework.views import APIView
17
+ from django.utils.decorators import method_decorator
17
18
  from rest_framework.request import Request
18
- from bkoauth import get_app_access_token
19
- from apigw_manager.apigw.decorators import apigw_require
19
+ from rest_framework.views import APIView
20
20
 
21
21
  from bk_plugin_framework.envs import settings
22
- from bk_plugin_framework.kit.decorators import login_exempt, inject_user_token
23
22
  from bk_plugin_framework.kit.authentication import CsrfExemptSessionAuthentication
23
+ from bk_plugin_framework.kit.decorators import inject_user_token, login_exempt
24
24
 
25
25
  custom_authentication_classes = (
26
26
  [
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,6 +8,7 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  from rest_framework.authentication import SessionAuthentication
13
13
 
14
14
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,6 +8,7 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  from functools import wraps
13
13
 
14
14
  from bk_plugin_framework.envs import settings
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,18 +9,21 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
12
+ import inspect
13
13
  import re
14
14
  import typing
15
- import inspect
16
15
 
17
16
  try:
18
17
  from pydantic.v1 import BaseModel
19
18
  except ImportError:
20
19
  from pydantic import BaseModel
21
20
 
22
- from bk_plugin_framework.hub import VersionHub
23
21
  from bk_plugin_framework.constants import State
24
- from bk_plugin_framework.runtime.callback.api import prepare_callback, CallbackPreparation
22
+ from bk_plugin_framework.hub import VersionHub
23
+ from bk_plugin_framework.runtime.callback.api import (
24
+ CallbackPreparation,
25
+ prepare_callback,
26
+ )
25
27
 
26
28
  VALID_VERSION_PATTERN = re.compile(r"^[0-9]+\.[0-9]+\.[0-9][a-z0-9]*$")
27
29
 
@@ -50,7 +52,7 @@ class ContextRequire(BaseModel):
50
52
  pass
51
53
 
52
54
 
53
- class Callback(object):
55
+ class Callback:
54
56
  def __init__(self, callback_id: str = "", callback_data: dict = {}):
55
57
  self.id = callback_id
56
58
  self.data = callback_data
@@ -1,10 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
1
  import os
3
2
  import socket
4
3
  import time
5
4
  from functools import wraps
6
5
 
7
- from prometheus_client import Counter, Histogram, Gauge
6
+ from prometheus_client import Counter, Gauge, Histogram
8
7
 
9
8
 
10
9
  def get_hostname():
@@ -129,14 +128,16 @@ BK_PLUGIN_SCHEDULE_TIME = Histogram(
129
128
 
130
129
  # 正在执行的 EXECUTE 数量
131
130
  BK_PLUGIN_EXECUTE_RUNNING_PROCESSES = Gauge(
132
- name="bk_plugin_execute_running_processes", documentation="count running state processes",
133
- labelnames=["hostname", "version"]
131
+ name="bk_plugin_execute_running_processes",
132
+ documentation="count running state processes",
133
+ labelnames=["hostname", "version"],
134
134
  )
135
135
 
136
136
  # 正在执行的 SCHEDULE 数量
137
137
  BK_PLUGIN_SCHEDULE_RUNNING_PROCESSES = Gauge(
138
- name="bk_plugin_schedule_running_processes", documentation="count running state schedules",
139
- labelnames=["hostname", "version"]
138
+ name="bk_plugin_schedule_running_processes",
139
+ documentation="count running state schedules",
140
+ labelnames=["hostname", "version"],
140
141
  )
141
142
 
142
143
  # CALLBACK 异常次数
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,23 +8,24 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
- import uuid
13
- import time
11
+
14
12
  import json
15
13
  import logging
14
+ import time
15
+ import uuid
16
16
 
17
- from django.conf import settings as default_settings
18
17
  from celery import current_app
19
18
  from cryptography.fernet import Fernet
19
+ from django.conf import settings as default_settings
20
20
 
21
+ from bk_plugin_framework.constants import State
21
22
  from bk_plugin_framework.envs import settings
22
23
  from bk_plugin_framework.runtime.schedule.models import Schedule
23
- from bk_plugin_framework.constants import State
24
24
 
25
25
  logger = logging.getLogger("bk_plugin")
26
26
 
27
27
 
28
- class CallbackPreparation(object):
28
+ class CallbackPreparation:
29
29
  def __init__(self, callback_id: str, callback_url: str):
30
30
  self.id = callback_id
31
31
  self.url = callback_url
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,21 +8,26 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  import json
13
13
  import logging
14
14
  import random
15
15
  import time
16
16
 
17
- from celery import shared_task, current_app
17
+ from celery import current_app, shared_task
18
18
 
19
- from bk_plugin_framework.kit import State
20
- from bk_plugin_framework.metrics import BK_PLUGIN_CALLBACK_EXCEPTION_COUNT, HOSTNAME, BK_PLUGIN_CALLBACK_TIME
21
- from bk_plugin_framework.utils import local
22
19
  from bk_plugin_framework.envs import settings
23
20
  from bk_plugin_framework.hub import VersionHub
21
+ from bk_plugin_framework.kit import State
22
+ from bk_plugin_framework.metrics import (
23
+ BK_PLUGIN_CALLBACK_EXCEPTION_COUNT,
24
+ BK_PLUGIN_CALLBACK_TIME,
25
+ HOSTNAME,
26
+ )
24
27
  from bk_plugin_framework.runtime.executor import BKPluginExecutor
25
28
  from bk_plugin_framework.runtime.schedule.models import Schedule
26
29
  from bk_plugin_framework.runtime.schedule.utils import get_schedule_lock
30
+ from bk_plugin_framework.utils import local
27
31
 
28
32
  logger = logging.getLogger("bk_plugin")
29
33
 
@@ -60,7 +64,7 @@ def callback(trace_id: str, callback_id: str, callback_data: str):
60
64
 
61
65
  if schedule.state is not State.CALLBACK.value:
62
66
  logger.exception(
63
- "[callback_task] schedule state[%s] is not CALLBACK,trace_id[%s]" % (schedule.state, trace_id)
67
+ "[callback_task] schedule state[{}] is not CALLBACK,trace_id[{}]".format(schedule.state, trace_id)
64
68
  )
65
69
  return
66
70
 
@@ -80,4 +84,5 @@ def callback(trace_id: str, callback_id: str, callback_data: str):
80
84
  _set_schedule_state(trace_id=trace_id, state=State.FAIL)
81
85
 
82
86
  BK_PLUGIN_CALLBACK_TIME.labels(hostname=HOSTNAME, version=schedule.plugin_version).observe(
83
- time.perf_counter() - start)
87
+ time.perf_counter() - start
88
+ )
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  import json
3
2
  import logging
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -11,8 +10,8 @@ specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
13
12
  import json
14
- import typing
15
13
  import logging
14
+ import typing
16
15
 
17
16
  from celery import current_app
18
17
 
@@ -20,22 +19,30 @@ try:
20
19
  from pydantic.v1 import ValidationError
21
20
  except ImportError:
22
21
  from pydantic import ValidationError
22
+
23
23
  from django.utils.timezone import now
24
24
 
25
- from bk_plugin_framework.kit import Plugin, Context, State, InputsModel, ContextRequire, Callback
25
+ from bk_plugin_framework.kit import (
26
+ Callback,
27
+ Context,
28
+ ContextRequire,
29
+ InputsModel,
30
+ Plugin,
31
+ State,
32
+ )
26
33
  from bk_plugin_framework.kit.plugin import PluginCallbackModel
27
34
  from bk_plugin_framework.metrics import (
28
- HOSTNAME,
29
- BK_PLUGIN_EXECUTE_FAILED_COUNT,
30
35
  BK_PLUGIN_EXECUTE_EXCEPTION_COUNT,
31
- BK_PLUGIN_SCHEDULE_FAILED_COUNT,
32
- BK_PLUGIN_SCHEDULE_EXCEPTION_COUNT,
33
- setup_gauge,
34
- setup_histogram,
36
+ BK_PLUGIN_EXECUTE_FAILED_COUNT,
35
37
  BK_PLUGIN_EXECUTE_RUNNING_PROCESSES,
36
38
  BK_PLUGIN_EXECUTE_TIME,
39
+ BK_PLUGIN_SCHEDULE_EXCEPTION_COUNT,
40
+ BK_PLUGIN_SCHEDULE_FAILED_COUNT,
37
41
  BK_PLUGIN_SCHEDULE_RUNNING_PROCESSES,
38
42
  BK_PLUGIN_SCHEDULE_TIME,
43
+ HOSTNAME,
44
+ setup_gauge,
45
+ setup_histogram,
39
46
  )
40
47
  from bk_plugin_framework.runtime.callbacker import PluginCallbacker
41
48
  from bk_plugin_framework.runtime.schedule.models import Schedule
@@ -179,7 +186,9 @@ class BKPluginExecutor:
179
186
 
180
187
  return ExecuteResult(state=State.FAIL, outputs=None, err="schedule task dispatch error: %s" % str(e))
181
188
 
182
- logger.info("[execute] task delay success, task_id: %s, count_down: %s" % (task_id, plugin.poll_interval))
189
+ logger.info(
190
+ "[execute] task delay success, task_id: {}, count_down: {}".format(task_id, plugin.poll_interval)
191
+ )
183
192
 
184
193
  return ExecuteResult(state=state, outputs=context.outputs, err=None)
185
194
 
@@ -315,7 +324,7 @@ class BKPluginExecutor:
315
324
  queue="plugin_schedule",
316
325
  )
317
326
  logger.info(
318
- "[schedule] task delay success, task_id: %s, count_down: %s" % (task_id, plugin.poll_interval)
327
+ "[schedule] task delay success, task_id: {}, count_down: {}".format(task_id, plugin.poll_interval)
319
328
  )
320
329
  except Exception:
321
330
  logger.exception("[schedule] schedule task dispatch error")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,7 +9,6 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
13
-
14
12
  from django.contrib import admin
15
13
 
16
14
  from bk_plugin_framework.runtime.loghub import models
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,7 +9,6 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
13
-
14
12
  from django.db import models
15
13
 
16
14
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,7 +9,6 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
13
-
14
12
  from django.contrib import admin
15
13
 
16
14
  from bk_plugin_framework.runtime.schedule import models
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -17,4 +16,4 @@ class ScheduleConfig(AppConfig):
17
16
  name = "bk_plugin_framework.runtime.schedule"
18
17
 
19
18
  def ready(self):
20
- from .celery.tasks import schedule, delete_expired_schedule # noqa
19
+ from .celery.tasks import delete_expired_schedule, schedule # noqa
@@ -0,0 +1,10 @@
1
+ """
2
+ Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
3
+ Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
4
+ Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://opensource.org/licenses/MIT
7
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9
+ specific language governing permissions and limitations under the License.
10
+ """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -14,12 +13,12 @@ import logging
14
13
 
15
14
  from celery import shared_task
16
15
 
17
- from bk_plugin_framework.kit import State
18
- from bk_plugin_framework.utils import local
19
16
  from bk_plugin_framework.envs import settings
20
17
  from bk_plugin_framework.hub import VersionHub
18
+ from bk_plugin_framework.kit import State
21
19
  from bk_plugin_framework.runtime.executor import BKPluginExecutor
22
20
  from bk_plugin_framework.runtime.schedule.models import Schedule
21
+ from bk_plugin_framework.utils import local
23
22
 
24
23
  logger = logging.getLogger("bk_plugin")
25
24
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -10,7 +9,6 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
12
11
 
13
-
14
12
  from django.db import migrations, models
15
13
 
16
14
 
@@ -0,0 +1,10 @@
1
+ """
2
+ Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
3
+ Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
4
+ Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://opensource.org/licenses/MIT
7
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
8
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
9
+ specific language governing permissions and limitations under the License.
10
+ """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tencent is pleased to support the open source community by making 蓝鲸智云 - PaaS平台 (BlueKing - PaaS System) available.
4
3
  Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved.
@@ -9,10 +8,11 @@ Unless required by applicable law or agreed to in writing, software distributed
9
8
  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10
9
  specific language governing permissions and limitations under the License.
11
10
  """
11
+
12
12
  from bk_plugin_framework.runtime.schedule.models import Schedule
13
13
 
14
14
 
15
- class ScheduleLock(object):
15
+ class ScheduleLock:
16
16
  def __init__(self, trace_id: str):
17
17
  self.trace_id = trace_id
18
18
  self.locked = False