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

feat:流水线并发运行时,支持限制并发个数和排队 #10718 #10960

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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 @@ -126,39 +126,60 @@
key: 'parallelSetting',
value: this.$t(`settings.runningOption.${runLockType ?? '--'}`)
},
...(runLockType === 'group_lock'
...(['group_lock', 'multiple'].includes(runLockType)
? [{
key: 'parallelConfDetail'
}]
: []
)
]
},
parallelSettingRows () {
prarallelSettingRows () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parallelSettingRows

const runLockType = this.basicInfo?.runLockType?.toLowerCase?.()
if (runLockType === 'group_lock') {
return [
{
key: 'concurrencyGroup',
label: 'group.groupName',
value: this.basicInfo?.concurrencyGroup ?? '--'
},
{
key: 'concurrencyCancelInProgress',
label: 'settings.stopWhenNewCome',
value: this.$t(this.basicInfo?.concurrencyCancelInProgress ? 'true' : 'false')
},
...(!this.basicInfo?.concurrencyCancelInProgress
? [
{
key: 'maxQueueSize',
label: 'settings.largestNum',
value: this.basicInfo?.maxQueueSize ?? '--'
},
{
key: 'waitQueueTimeMinute',
label: 'settings.lagestTime',
value: Number.isInteger(this.basicInfo?.waitQueueTimeMinute) ? `${this.basicInfo?.waitQueueTimeMinute}${this.$t('settings.minutes')}` : '--'
}

]
: []
)
]
}

return [
{
key: 'concurrencyGroup',
label: 'group.groupName',
value: this.basicInfo?.concurrencyGroup ?? '--'
},
{
key: 'concurrencyCancelInProgress',
label: 'settings.stopWhenNewCome',
value: this.$t(this.basicInfo?.concurrencyCancelInProgress ? 'true' : 'false')
},
...(!this.basicInfo?.concurrencyCancelInProgress
? [
{
key: 'maxQueueSize',
label: 'settings.largestNum',
value: this.basicInfo?.maxQueueSize ?? '--'
key: 'maxConRunningQueueSize',
label: 'settings.concurrentMaxConcurrency',
value: this.basicInfo?.maxConRunningQueueSize ?? '--'
},
{
key: 'waitQueueTimeMinute',
label: 'settings.lagestTime',
label: 'settings.concurrentTimeout',
value: Number.isInteger(this.basicInfo?.waitQueueTimeMinute) ? `${this.basicInfo?.waitQueueTimeMinute}${this.$t('settings.minutes')}` : '--'
}

]
: []
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@
{{ $t('settings.runningOption.multiple') }}
</bk-radio>
</div>
</bk-radio-group>
<div
v-if="isMultipleLock"
class="single-lock-sub-form"
:key="pipelineSetting.runLockType"
>
<bk-form-item
:label="$t('settings.concurrentMaxConcurrency')"
error-display-type="normal"
property="maxConRunningQueueSize"
>
<bk-input
type="number"
:disabled="!editable"
:placeholder="$t('settings.maxConcurrencyPlaceholder')"
v-model="pipelineSetting.maxConRunningQueueSize"
@change="val => handleBaseInfoChange('maxConRunningQueueSize', val ? Number(val) : null)"
/>
</bk-form-item>

<bk-form-item
:required="isMultipleLock"
:label="$t('settings.concurrentTimeout')"
error-display-type="normal"
property="waitQueueTimeMinute"
>
<bk-input
type="number"
:disabled="!editable"
:placeholder="$t('settings.itemPlaceholder')"
v-model="pipelineSetting.waitQueueTimeMinute"
@change="val => handleBaseInfoChange('waitQueueTimeMinute', val ? Number(val) : null)"
>
<template slot="append">
<span class="pipeline-setting-unit">{{ $t('settings.minutes') }}</span>
</template>
</bk-input>
</bk-form-item>
</div>
<bk-radio-group
:value="pipelineSetting.runLockType"
@change="handleLockTypeChange"
>
<div class="run-lock-radio-item">
<bk-radio
:disabled="!editable"
Expand All @@ -65,9 +108,10 @@
</div>
</bk-radio-group>
</bk-form-item>

<div
class="single-lock-sub-form"
v-if="isSingleLock"
class="single-lock-sub-form"
>
<bk-form-item
:required="isSingleLock"
Expand Down Expand Up @@ -176,6 +220,9 @@
isSingleLock () {
return [this.runTypeMap.GROUP, this.runTypeMap.SINGLE].includes(this.pipelineSetting?.runLockType)
},
isMultipleLock () {
return [this.runTypeMap.MULTIPLE].includes(this.pipelineSetting?.runLockType)
},
formRule () {
const requiredRule = {
required: this.isSingleLock,
Expand All @@ -202,9 +249,25 @@
{
validator: (val) => {
const intVal = parseInt(val, 10)
return !this.isSingleLock || (intVal <= 1440 && intVal >= 1)
if (this.isSingleLock || this.isMultipleLock) {
return intVal <= 1440 && intVal >= 1
}
return true
},
message: `${this.isSingleLock
? this.$t('settings.lagestTime')
: this.$t('settings.concurrentTimeout')
}${this.$t('numberRange', [1, 1440])}`,
trigger: 'blur'
}
],
maxConRunningQueueSize: [
requiredRule,
{
validator: (val) => {
return /^(?:[1-9]|[1-9][0-9]|1[0-9]{2}|200)$/.test(val)
},
message: `${this.$t('settings.lagestTime')}${this.$t('numberRange', [1, 1440])}`,
message: this.$t('settings.maxConRunningQueueSizeTips'),
trigger: 'blur'
}
]
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/locale/pipeline/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@
"mdLink": "Markdown Link",
"conCopySuc": "Copied Succeed",
"additionDesc": "Description",
"voice": "Voice"
"voice": "Voice",
"concurrentMaxConcurrency": "Maximum Concurrency",
"concurrentTimeout": "Queue Timeout for Exceeding Limit",
"maxConRunningQueueSizeTips": "The range of maximum concurrency is between 1 and 200-200之间",
"maxConcurrencyPlaceholder": "Default to system settings when not specified"
},
"template": {
"addTemplate": "New Template",
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/locale/pipeline/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@
"mdLink": "markdown链接",
"conCopySuc": "内容复制成功",
"additionDesc": "其他描述",
"voice": "语音"
"voice": "语音",
"concurrentMaxConcurrency": "最大可并发数",
"concurrentTimeout": "超限时排队,排队超时时间",
"maxConRunningQueueSizeTips": "最大可并发数范围在1-200之间",
"maxConcurrencyPlaceholder": "缺省时以系统设置为准"
},
"template": {
"addTemplate": "新建模板",
Expand Down
Loading