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

Feature/pipeline queue manager #2334

Merged

Conversation

chengjoey
Copy link
Contributor

What type of this PR

Add one of the following kinds:
/kind feature

What this PR does / why we need it:

update queue usage to etcd for multiple pipeline

Which issue(s) this PR fixes:

Specified Reviewers:

/assign @your-reviewer

ChangeLog

Language Changelog
🇺🇸 English pipeline queue manager
🇨🇳 中文 queue manager 调整

Need cherry-pick to release versions?

Add comment like /cherry-pick release/1.0 when this PR is merged.

For details on the cherry pick process, see the cherry pick requests section under CONTRIBUTING.md.

@chengjoey chengjoey added feature pipeline pipeline service labels Oct 12, 2021
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #2334 (b8a6bf7) into master (2ff0739) will decrease coverage by 0.18%.
The diff coverage is 20.40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2334      +/-   ##
==========================================
- Coverage   15.90%   15.72%   -0.19%     
==========================================
  Files        1195     1214      +19     
  Lines      118228   122682    +4454     
==========================================
+ Hits        18810    19286     +476     
- Misses      97500   101411    +3911     
- Partials     1918     1985      +67     
Impacted Files Coverage Δ
modules/pipeline/endpoints/queue_management.go 0.00% <0.00%> (ø)
...les/pipeline/pipengine/reconciler/before_listen.go 0.00% <0.00%> (ø)
modules/pipeline/pipengine/reconciler/define.go 0.00% <ø> (ø)
...pengine/reconciler/queuemanage/manager/snapshot.go 0.00% <0.00%> (ø)
.../pipengine/reconciler/queuemanage/manager/usage.go 0.00% <0.00%> (ø)
modules/pipeline/pipengine/reconciler/throttler.go 40.54% <ø> (+1.06%) ⬆️
.../pipengine/reconciler/queuemanage/manager/queue.go 11.76% <13.88%> (+11.76%) ⬆️
modules/pipeline/pipengine/reconciler/queue.go 47.22% <48.57%> (+47.22%) ⬆️
...pipengine/reconciler/queuemanage/manager/define.go 50.00% <50.00%> (+11.11%) ⬆️
modules/cmp/component-protocol/cputil/util.go 24.36% <0.00%> (-14.98%) ⬇️
... and 49 more

@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch 2 times, most recently from fad96fc to 4790747 Compare October 12, 2021 09:47
@chengjoey
Copy link
Contributor Author

chengjoey commented Oct 12, 2021

image

@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch from 4790747 to 0751721 Compare October 12, 2021 10:01
@sfwn
Copy link
Member

sfwn commented Oct 12, 2021

Add at least 1000 pipeline to queue and tested it.
Maybe it will exceed max length of etcd value limit?

@chengjoey
Copy link
Contributor Author

2000 queue item consume about 86kb, one etcd key limit 1.5m value, so, one queue may save 35000 queue item

@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch 4 times, most recently from cd628b5 to 5ff713c Compare October 13, 2021 11:50
modules/pipeline/endpoints/queue_management.go Outdated Show resolved Hide resolved
modules/pipeline/initialize.go Show resolved Hide resolved
r.continueBackupQueueUsage(ctx)
}()
go func() {
r.QueueManager.Listen(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Listen what

modules/pipeline/pipengine/reconciler/define.go Outdated Show resolved Hide resolved
costTime = end.Sub(begin)
queueSnapshot := manager.SnapshotObj{}
if err := json.Unmarshal(backup, &queueSnapshot); err != nil {
errDone <- err
Copy link
Member

Choose a reason for hiding this comment

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

return here

})
}

func (mgr *defaultManager) SendPipelineIDS(queueID uint64, pipelineIDS []uint64) {
Copy link
Member

Choose a reason for hiding this comment

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

IDs

)

const (
etcdQueueWatchPrefix = "/devops/pipeline/queue/action/update/"
Copy link
Member

Choose a reason for hiding this comment

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

queue_manager/actions/

mgr.qLock.Lock()
defer mgr.qLock.Unlock()

// construct newQueue first for later use
Copy link
Member

Choose a reason for hiding this comment

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

Abstract these code to a function. And I remember already have a function?

return b
}

// Import default queue manager execute in memory, don't need import
Copy link
Member

Choose a reason for hiding this comment

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

load from database

@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch 2 times, most recently from 17d4b5d to bf43a39 Compare October 15, 2021 07:34
@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch from bf43a39 to aa96fdd Compare October 17, 2021 02:16
@@ -27,4 +30,9 @@ type QueueManager interface {
PopOutPipelineFromQueue(pipelineID uint64)
BatchUpdatePipelinePriorityInQueue(pq *apistructs.PipelineQueue, pipelineIDs []uint64) error
Stop()
SendQueueToETCD(queueID uint64)
Copy link
Member

Choose a reason for hiding this comment

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

all use Etcd

@chengjoey chengjoey force-pushed the feature/pipeline-queue-manager branch from aa96fdd to 7ef61d5 Compare October 18, 2021 02:10
sfwn
sfwn previously approved these changes Oct 18, 2021
@sfwn
Copy link
Member

sfwn commented Oct 18, 2021

/approve

@erda-bot erda-bot merged commit 377df39 into erda-project:master Oct 18, 2021
@sfwn
Copy link
Member

sfwn commented Oct 18, 2021

/cherry-pick release/1.3

erda-bot pushed a commit to erda-bot/erda that referenced this pull request Oct 18, 2021
* annotate backup throttler func

* query, update queue usage to etcd

* use protobuf marshal unmarshal queue usage

* watch etcd to update queue instead of in memory
johnlanni pushed a commit that referenced this pull request Oct 19, 2021
* annotate backup throttler func

* query, update queue usage to etcd

* use protobuf marshal unmarshal queue usage

* watch etcd to update queue instead of in memory

Co-authored-by: chengjoey <30427474+chengjoey@users.noreply.github.com>
@chengjoey chengjoey deleted the feature/pipeline-queue-manager branch April 18, 2022 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants