Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
celery-haystack-ng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository 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®
Libraries
celery-haystack-ng
Commits
e6b334fe
Verified
Commit
e6b334fe
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Properly register and use task
parent
5a2e19af
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
celery_haystack/tasks.py
+2
-4
2 additions, 4 deletions
celery_haystack/tasks.py
celery_haystack/utils.py
+2
-2
2 additions, 2 deletions
celery_haystack/utils.py
with
4 additions
and
6 deletions
celery_haystack/tasks.py
+
2
−
4
View file @
e6b334fe
...
@@ -13,6 +13,7 @@ from celery.utils.log import get_task_logger
...
@@ -13,6 +13,7 @@ from celery.utils.log import get_task_logger
logger
=
get_task_logger
(
__name__
)
logger
=
get_task_logger
(
__name__
)
@current_app.register_task
class
CeleryHaystackSignalHandler
(
current_app
.
Task
):
class
CeleryHaystackSignalHandler
(
current_app
.
Task
):
name
=
"
haystack_signal_handler
"
name
=
"
haystack_signal_handler
"
using
=
settings
.
CELERY_HAYSTACK_DEFAULT_ALIAS
using
=
settings
.
CELERY_HAYSTACK_DEFAULT_ALIAS
...
@@ -135,6 +136,7 @@ class CeleryHaystackSignalHandler(current_app.Task):
...
@@ -135,6 +136,7 @@ class CeleryHaystackSignalHandler(current_app.Task):
raise
ValueError
(
"
Unrecognized action %s
"
%
action
)
raise
ValueError
(
"
Unrecognized action %s
"
%
action
)
@current_app.register_task
class
CeleryHaystackUpdateIndex
(
current_app
.
Task
):
class
CeleryHaystackUpdateIndex
(
current_app
.
Task
):
"""
"""
A celery task class to be used to call the update_index management
A celery task class to be used to call the update_index management
...
@@ -158,7 +160,3 @@ class CeleryHaystackUpdateIndex(current_app.Task):
...
@@ -158,7 +160,3 @@ class CeleryHaystackUpdateIndex(current_app.Task):
logger
.
info
(
"
Starting update index
"
)
logger
.
info
(
"
Starting update index
"
)
call_command
(
'
update_index
'
,
*
apps
,
**
defaults
)
call_command
(
'
update_index
'
,
*
apps
,
**
defaults
)
logger
.
info
(
"
Finishing update index
"
)
logger
.
info
(
"
Finishing update index
"
)
CeleryHaystackSignalHandler
=
current_app
.
register_task
(
CeleryHaystackSignalHandler
())
CeleryHaystackUpdateIndex
=
current_app
.
register_task
(
CeleryHaystackUpdateIndex
())
This diff is collapsed.
Click to expand it.
celery_haystack/utils.py
+
2
−
2
View file @
e6b334fe
...
@@ -19,11 +19,11 @@ def get_update_task(task_path=None):
...
@@ -19,11 +19,11 @@ def get_update_task(task_path=None):
raise
ImproperlyConfigured
(
'
Error importing module %s:
"
%s
"'
%
raise
ImproperlyConfigured
(
'
Error importing module %s:
"
%s
"'
%
(
module
,
e
))
(
module
,
e
))
try
:
try
:
T
ask
=
getattr
(
mod
,
attr
)
t
ask
=
getattr
(
mod
,
attr
)
except
AttributeError
:
except
AttributeError
:
raise
ImproperlyConfigured
(
'
Module
"
%s
"
does not define a
"
%s
"
'
raise
ImproperlyConfigured
(
'
Module
"
%s
"
does not define a
"
%s
"
'
'
class.
'
%
(
module
,
attr
))
'
class.
'
%
(
module
,
attr
))
return
T
ask
()
return
t
ask
def
enqueue_task
(
action
,
instance
,
**
kwargs
):
def
enqueue_task
(
action
,
instance
,
**
kwargs
):
...
...
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