Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 新增API插件超时时间支持任务模块级别配置 #87 #88

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ def _dispatch_schedule_polling(self, data, parent_data, callback_data=None):
)
try:
request_result: HttpRequestResult = client.request(
url=polling_config.url, method="get", data=api_data, headers=headers, timeout=30
url=polling_config.url,
method="get",
data=api_data,
headers=headers,
timeout=settings.BKAPP_ENGINE_PLUGIN_TIMEOUT,
)
except Exception as e:
message = handle_plain_log("[uniform_api polling error] url request failed: {}".format(e))
Expand Down
3 changes: 3 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
# 默认引擎模块入口
BKAPP_DEFAULT_ENGINE_MODULE_ENTRY = os.getenv("BKAPP_DEFAULT_ENGINE_MODULE_ENTRY", "")

# 默认引擎插件超时时间
BKAPP_ENGINE_PLUGIN_TIMEOUT = os.getenv("BKAPP_ENGINE_PLUGIN_TIMEOUT", 30)

CALLBACK_KEY = os.getenv("BKFLOW_DEFAULT_CALLBACK_KEY", "").encode("utf-8")

BK_PAAS_ESB_HOST = os.getenv("BK_COMPONENT_API_URL", "")
Expand Down
5 changes: 1 addition & 4 deletions module_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ def check_engine_admin_permission(request, *args, **kwargs):
BKFLOW_MODULE = BKFLOWModule.get_module()

if env.BKFLOW_MODULE_TYPE == BKFLOWModuleType.engine.value:

if BKFLOW_MODULE.broker_url:
BROKER_URL = env.BKFLOW_CELERY_BROKER_URL

if BKFLOW_MODULE.isolation_level == BKFLOWResourceIsolationLevel.all_resource.value:
db_config = BKFLOWDatabaseConfig.get_database_config()
DATABASES = {
Expand All @@ -132,7 +130,7 @@ def check_engine_admin_permission(request, *args, **kwargs):
CELERY_QUEUES.extend(get_task_queues(BKFLOW_MODULE.code))

PIPELINE_ENGINE_ADMIN_API_PERMISSION = "module_settings.check_engine_admin_permission"

BKAPP_ENGINE_PLUGIN_TIMEOUT = env.BKAPP_ENGINE_PLUGIN_TIMEOUT
INSTALLED_APPS += (
"rest_framework",
"drf_yasg",
Expand Down Expand Up @@ -186,7 +184,6 @@ def check_engine_admin_permission(request, *args, **kwargs):
LOG_PERSISTENT_DAYS = env.LOG_PERSISTENT_DAYS

elif env.BKFLOW_MODULE_TYPE == BKFLOWModuleType.interface.value:

INSTALLED_APPS += (
"rest_framework",
"drf_yasg",
Expand Down
Loading