Skip to content

Commit

Permalink
feat:流水线并发运行时,支持限制并发个数和排队 #10718
Browse files Browse the repository at this point in the history
  • Loading branch information
yongyiduan committed Oct 10, 2024
1 parent b247dab commit 682061a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,11 @@ class PipelineSettingDao {
.set(SUCCESS_SUBSCRIPTION, JsonUtil.toJson(successSubscriptionList, false))
.set(FAILURE_SUBSCRIPTION, JsonUtil.toJson(failSubscriptionList, false))
.set(VERSION, setting.version)
.set(MAX_CON_RUNNING_QUEUE_SIZE, setting.maxConRunningQueueSize)
// pipelineAsCodeSettings 默认传空不更新
setting.pipelineAsCodeSettings?.let { self ->
insert.set(PIPELINE_AS_CODE_SETTINGS, JsonUtil.toJson(self, false))
}
// maxConRunningQueueSize 默认传空不更新
if (setting.maxConRunningQueueSize != null) {
insert.set(MAX_CON_RUNNING_QUEUE_SIZE, setting.maxConRunningQueueSize)
}
return insert.execute()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ package com.tencent.devops.process.api.op

import com.tencent.bk.audit.annotations.AuditEntry
import com.tencent.devops.common.api.exception.ExecuteException
import com.tencent.devops.common.api.exception.InvalidParamException
import com.tencent.devops.common.api.pojo.PipelineAsCodeSettings
import com.tencent.devops.common.api.pojo.Result
import com.tencent.devops.common.api.util.MessageUtil
Expand All @@ -38,12 +37,9 @@ import com.tencent.devops.common.client.Client
import com.tencent.devops.common.pipeline.pojo.setting.PipelineSetting
import com.tencent.devops.common.web.RestResource
import com.tencent.devops.common.web.utils.I18nUtil
import com.tencent.devops.process.constant.ProcessMessageCode.MAXIMUM_NUMBER_CONCURRENCY_ILLEGAL
import com.tencent.devops.process.constant.ProcessMessageCode.PROJECT_NOT_EXIST
import com.tencent.devops.process.dao.PipelineSettingDao
import com.tencent.devops.process.service.pipeline.PipelineSettingFacadeService
import com.tencent.devops.process.utils.PIPELINE_SETTING_MAX_CON_QUEUE_SIZE_MAX
import com.tencent.devops.process.utils.PIPELINE_SETTING_MAX_QUEUE_SIZE_MIN
import com.tencent.devops.project.api.op.OPProjectResource
import com.tencent.devops.project.api.service.ServiceProjectResource
import com.tencent.devops.project.pojo.ProjectProperties
Expand Down Expand Up @@ -89,7 +85,6 @@ class OpPipelineSettingResourceImpl @Autowired constructor(
pipelineId: String,
maxConRunningQueueSize: Int
): Result<String> {
checkMaxConRunningQueueSize(maxConRunningQueueSize)
return Result(
pipelineSettingFacadeService.updateMaxConRunningQueueSize(
userId = userId,
Expand Down Expand Up @@ -151,16 +146,4 @@ class OpPipelineSettingResourceImpl @Autowired constructor(
).data == true
return Result(success)
}

private fun checkMaxConRunningQueueSize(maxConRunningQueueSize: Int) {
if (maxConRunningQueueSize <= PIPELINE_SETTING_MAX_QUEUE_SIZE_MIN ||
maxConRunningQueueSize > PIPELINE_SETTING_MAX_CON_QUEUE_SIZE_MAX
) {
throw InvalidParamException(
message = I18nUtil.getCodeLanMessage(MAXIMUM_NUMBER_CONCURRENCY_ILLEGAL),
errorCode = MAXIMUM_NUMBER_CONCURRENCY_ILLEGAL,
params = arrayOf("maxConRunningQueueSize")
)
}
}
}

0 comments on commit 682061a

Please sign in to comment.