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
add celery tasks, now call these from models #3798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the functions are moved to tasks, I'll expect some unit tests to fail (because the corresponding work would be done accordingly). I think you'll also have to reorder those parts of the unit tests, possibly create tests for the new tasks in the proper test module.
One more thing, I think it's worth adding an entry in the release notes saying that these actions will now be done asynchronously, please add a news fragment.
bodhi/server/models.py
Outdated
# EL6 doesn't have these, and that's okay... | ||
# We still warn in case the config gets messed up. | ||
log.warning('%s has no pending_signing_tag' % up.release.name) | ||
tag_build(new_builds, up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Celery tasks are called using the .delay()
method, please check out how it's done with the handle_update()
task.
bodhi/server/services/updates.py
Outdated
to_tag = side_tag_signing_pending | ||
# Move every new build to <from_tag>-signing-pending tag | ||
update.add_tag(to_tag) | ||
create_tag(updates, from_tag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here, you'll have to use the .delay()
method.
bodhi/server/tasks/__init__.py
Outdated
|
||
|
||
@app.task(name="create_tag") | ||
def create_tag(updates: list, from_tag): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is from_tag
supposed to be a string? If so, please type it accordingly.
bodhi/server/tasks/__init__.py
Outdated
|
||
|
||
@app.task(name="tag_build") | ||
def tag_build(builds: list, update): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please type the update
argument.
Unless I'm mistaken this code is only using the Koji API, so it can be executed from anywhere, we don't need the actual mount. |
The type hints introduced a cyclic import (models -> tasks -> models) for which I have a fix locally. I noticed, however, that (expectedly) some existing tests block on when calling the new tasks. I'll mock these calls out and instead add unit tests testing |
This fixes the tests breaking because of the introduction of using Celery tasks for Koji tagging. Needs unit tests for the new Celery tasks, though, so still WIP. |
This pull request introduces 2 alerts when merging f8fd4c9 into 1be3f91 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging 3234d71 into ab024c9 - view on LGTM.com new alerts:
|
d74f3c2
to
6787158
Compare
This pull request introduces 2 alerts when merging 6787158 into 63f9756 - view on LGTM.com new alerts:
|
This commit moves the calls to koji to tag builds from an update to an async celery task. Signed-off-by: Stephen Coady <scoady@redhat.com> Signed-off-by: Nils Philippsen <nils@redhat.com> Signed-off-by: Clement Verna <cverna@tutanota.com> Remove obsolete tests & mock out new task handlers Signed-off-by: Nils Philippsen <nils@redhat.com> Add unit tests for the new tasks
This pull request introduces 2 alerts when merging 23a1609 into 3268af0 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging d66a0fb into 9c4cfea - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
fyi @nphilipp
Signed-off-by: Stephen Coady scoady@redhat.com