-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: celery 5 & redis 依赖包升级适配 (#230)
* feat: pipeline dependencies version update (#227) * feat: pipeline dependencies version update * minor: flake8 fix * minor: unit test fix * Update pr_check.yml * minor: git ci fix * minor: git ci fix --------- Co-authored-by: NULL <[email protected]> * feat: celery 4 & 5 异步任务用法兼容 * feat: pipeline release 3.29.3 * fix: fix engine unittest coverage ci --------- Co-authored-by: NULL <[email protected]>
- Loading branch information
1 parent
54409dd
commit 88e426f
Showing
25 changed files
with
608 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
|
||
default_app_config = "pipeline.apps.PipelineConfig" | ||
|
||
__version__ = "3.29.2" | ||
__version__ = "3.29.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
runtime/bamboo-pipeline/pipeline/contrib/celery_tools/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community | ||
Edition) available. | ||
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" |
47 changes: 47 additions & 0 deletions
47
runtime/bamboo-pipeline/pipeline/contrib/celery_tools/periodic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community | ||
Edition) available. | ||
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
from celery import Task, current_app | ||
from celery.schedules import maybe_schedule | ||
|
||
|
||
class PipelinePeriodicTask(Task): | ||
"""A task that adds itself to the :setting:`beat_schedule` setting.""" | ||
|
||
abstract = True | ||
ignore_result = True | ||
relative = False | ||
options = None | ||
compat = True | ||
|
||
def __init__(self): | ||
if not hasattr(self, 'run_every'): | ||
raise NotImplementedError( | ||
'Periodic tasks must have a run_every attribute') | ||
self.run_every = maybe_schedule(self.run_every, self.relative) | ||
super(PipelinePeriodicTask, self).__init__() | ||
|
||
@classmethod | ||
def on_bound(cls, app): | ||
app.conf.beat_schedule[cls.name] = { | ||
'task': cls.name, | ||
'schedule': cls.run_every, | ||
'args': (), | ||
'kwargs': {}, | ||
'options': cls.options or {}, | ||
'relative': cls.relative, | ||
} | ||
|
||
|
||
def periodic_task(*args, **options): | ||
"""Deprecated decorator, please use :setting:`beat_schedule`.""" | ||
return current_app.task(**dict({'base': PipelinePeriodicTask}, **options)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.