Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
94b1f541
Verified
Commit
94b1f541
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Improve return value of celery_optional task
parent
4627d10e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!389
Add data check system
Pipeline
#5040
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/util/core_helpers.py
+8
-3
8 additions, 3 deletions
aleksis/core/util/core_helpers.py
aleksis/core/views.py
+1
-1
1 addition, 1 deletion
aleksis/core/views.py
with
9 additions
and
4 deletions
aleksis/core/util/core_helpers.py
+
8
−
3
View file @
94b1f541
...
...
@@ -195,6 +195,12 @@ def celery_optional(orig: Callable) -> Callable:
If Celery is configured and available, it wraps the function in a Task
and calls its delay method when invoked; if not, it leaves it untouched
and it is executed synchronously.
The wrapped function returns a tuple with either
the return value of the task
'
s delay method and False
if the method has been executed asynchronously
or the return value of the executed method and True
if the method has been executed synchronously.
"""
if
is_celery_enabled
():
from
..celery
import
app
# noqa
...
...
@@ -203,10 +209,9 @@ def celery_optional(orig: Callable) -> Callable:
def
wrapped
(
*
args
,
**
kwargs
):
if
is_celery_enabled
():
task
.
delay
(
*
args
,
**
kwargs
)
return
task
.
delay
(
*
args
,
**
kwargs
)
,
False
else
:
orig
(
*
args
,
**
kwargs
)
return
True
return
orig
(
*
args
,
**
kwargs
),
True
return
wrapped
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
1
−
1
View file @
94b1f541
...
...
@@ -728,7 +728,7 @@ class RunDataChecks(PermissionRequiredMixin, View):
permission_required
=
"
core.run_data_checks
"
def
get
(
self
,
request
:
HttpRequest
,
*
args
,
**
kwargs
)
->
HttpResponse
:
if
not
check_data
():
if
not
check_data
()
[
1
]
:
messages
.
success
(
request
,
_
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment