refactor dojo async task base task#13986
refactor dojo async task base task#13986valentijnscholten wants to merge 46 commits intoDefectDojo:devfrom
Conversation
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Co-authored-by: Cody Maffucci <[email protected]>
31a5314 to
917aa72
Compare
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…sk-base-task # Conflicts: # dojo/endpoint/views.py # unittests/test_importers_performance.py
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Maffooch
left a comment
There was a problem hiding this comment.
Tested by hand in all the places
|
This looks great but will probably cause conflicts with the locations PR; at the least, some of the code there will need to be updated to take advantage of these improvements. Maybe we should hold off on merging this one until the next release? @mtesauro |
mtesauro
left a comment
There was a problem hiding this comment.
I would like to hold on this until after Locations lands as getting Locations in place allows other code changes to move forward while avoiding inevitable conflicts.
|
I don't really mind if we merge this one before monday or shortly after. But we have to be aware that any async tasks related to endpoints should probably be converted into synchronous code or be called with |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
…sk-base-task # Conflicts: # dojo/importers/base_importer.py # dojo/product/helpers.py # dojo/tags_signals.py # dojo/utils.py
- Remove @dojo_async_task decorator - Use dojo_dispatch_task for calling Celery tasks - Convert task methods to static-like functions (no self parameter) - Make get_or_create_location and clean_unsaved_locations static methods
|
Conflicts have been resolved. A maintainer will review the pull request shortly. |
|
Closed in favor of #14240 |
The custom decorators that we have on Celery tasks interfere with some (advanced) celery functionality like signatures. This PR refactors this to have a clean base task that passes on context, but does not interfere with celery mechanisms.
The logic to decide whether or not the task is to be called asyncrhonously is now in a dispatch method.
Pro needs similar changes via https://github.com/DefectDojo-Inc/dojo-pro/pull/973, these must be merged "at the same time".