From 839098c027bf1098a7c9d70f3557919455c17753 Mon Sep 17 00:00:00 2001 From: carlyin <449036249@qq.com> Date: Tue, 20 Aug 2024 20:57:28 +0800 Subject: [PATCH] =?UTF-8?q?pref:=E5=85=AC=E5=85=B1=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=9C=BA=E6=8F=92=E4=BB=B6=E7=BC=93=E5=AD=98=E5=8C=BA=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=92=8C=E5=8F=98=E9=87=8F=E8=B0=83=E6=95=B4=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20#10844?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devops/dispatch/constants/Constants.kt | 2 ++ .../tencent/devops/worker/common/env/AgentEnv.kt | 2 -- .../worker/common/task/market/MarketAtomTask.kt | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/backend/ci/core/dispatch/api-dispatch/src/main/kotlin/com/tencent/devops/dispatch/constants/Constants.kt b/src/backend/ci/core/dispatch/api-dispatch/src/main/kotlin/com/tencent/devops/dispatch/constants/Constants.kt index b238bdbfd45..11357f29cef 100644 --- a/src/backend/ci/core/dispatch/api-dispatch/src/main/kotlin/com/tencent/devops/dispatch/constants/Constants.kt +++ b/src/backend/ci/core/dispatch/api-dispatch/src/main/kotlin/com/tencent/devops/dispatch/constants/Constants.kt @@ -44,6 +44,8 @@ const val EXCHANGE_TASK = "exchange_vm_task" const val ROUTE_TASK_BEGIN = "dispatch_vm_task_begin" const val ROUTE_TASK_END = "dispatch_vm_task_end" const val ROUTE_TASK_NEDD_END = "dispatch_vm_task_need_end" +const val ENV_PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE = "PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE" +const val ENV_THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE = "THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE" // |Docker构建|最大并行构建量(maximum parallelism)/当前正在运行构建数量(Running): const val BK_DOCKER_BUILD_VOLUME = "bkDockerBuildVolume" diff --git a/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/env/AgentEnv.kt b/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/env/AgentEnv.kt index e4f67990d6e..9d1ec7ee358 100644 --- a/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/env/AgentEnv.kt +++ b/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/env/AgentEnv.kt @@ -61,8 +61,6 @@ object AgentEnv { const val AGENT_LOG_SAVE_MODE = "devops_log_save_mode" const val AGENT_PROPERTIES_FILE_NAME = ".agent.properties" const val BK_TAG = "devops_bk_tag" - const val PUBLIC_HOST_MAX_FILE_CACHE_SIZE = "devops.public.host.maxFileCacheSize" - const val THIRD_HOST_MAX_FILE_CACHE_SIZE = "devops.public.third.maxFileCacheSize" private var projectId: String? = null private var agentId: String? = null diff --git a/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/task/market/MarketAtomTask.kt b/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/task/market/MarketAtomTask.kt index 7b86668ae9b..aa4dcfa47ae 100644 --- a/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/task/market/MarketAtomTask.kt +++ b/src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/task/market/MarketAtomTask.kt @@ -58,6 +58,8 @@ import com.tencent.devops.common.pipeline.container.VMBuildContainer import com.tencent.devops.common.pipeline.enums.BuildStatus import com.tencent.devops.common.service.utils.CommonUtils import com.tencent.devops.common.webhook.pojo.code.BK_CI_RUN +import com.tencent.devops.dispatch.constants.ENV_PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE +import com.tencent.devops.dispatch.constants.ENV_THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE import com.tencent.devops.process.pojo.BuildTask import com.tencent.devops.process.pojo.BuildTemplateAcrossInfo import com.tencent.devops.process.pojo.BuildVariables @@ -431,16 +433,16 @@ open class MarketAtomTask : ITask() { } else { // 如果是公共构建机,插件包缓存放入流水线的工作空间上一级目录中 // 如果workspace路径是相对路径.,workspace.parentFile会为空,故需用file对象包装一下 - File(workspace.parentFile, "").absolutePath + File(workspace.parentFile, "cache").absolutePath } val fileCacheDir = "$cacheDirPrefix${File.separator}$atomExecuteFileDir" // 获取构建机缓存文件区域大小 val maxFileCacheSize = if (BuildEnv.isThirdParty()) { - AgentEnv.getEnvProp(AgentEnv.THIRD_HOST_MAX_FILE_CACHE_SIZE)?.toLong() - ?: DEFAULT_THIRD_HOST_MAX_FILE_CACHE_SIZE + AgentEnv.getEnvProp(ENV_THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE)?.toLong() + ?: DEFAULT_THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE } else { - AgentEnv.getEnvProp(AgentEnv.PUBLIC_HOST_MAX_FILE_CACHE_SIZE)?.toLong() - ?: DEFAULT_PUBLIC_HOST_MAX_FILE_CACHE_SIZE + AgentEnv.getEnvProp(ENV_PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE)?.toLong() + ?: DEFAULT_PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE } logger.info("getDiskLruFileCache fileCacheDir:$fileCacheDir,maxFileCacheSize:$maxFileCacheSize") val bkDiskLruFileCache = BkDiskLruFileCacheFactory.getDiskLruFileCache(fileCacheDir, maxFileCacheSize) @@ -1102,8 +1104,8 @@ open class MarketAtomTask : ITask() { private const val DIR_ENV = "bk_data_dir" private const val INPUT_ENV = "bk_data_input" private const val OUTPUT_ENV = "bk_data_output" - private const val DEFAULT_PUBLIC_HOST_MAX_FILE_CACHE_SIZE = 209715200L - private const val DEFAULT_THIRD_HOST_MAX_FILE_CACHE_SIZE = 2147483648L + private const val DEFAULT_PUBLIC_HOST_MAX_ATOM_FILE_CACHE_SIZE = 209715200L + private const val DEFAULT_THIRD_HOST_MAX_ATOM_FILE_CACHE_SIZE = 2147483648L private val logger = LoggerFactory.getLogger(MarketAtomTask::class.java) } }