Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jochem Bijlard
fractalis
Commits
5871d040
Commit
5871d040
authored
May 16, 2018
by
Sascha Herzinger
Browse files
Fixed a bug in celery state handling
parent
111b4401
Changes
2
Hide whitespace changes
Inline
Side-by-side
fractalis/celeryapp.py
View file @
5871d040
...
...
@@ -15,14 +15,16 @@ logger = logging.getLogger(__name__)
# https://stackoverflow.com/questions/9824172/find-out-whether-celery-task-exists
@
after_task_publish
.
connect
def
update_submitted_state
(
sender
=
None
,
**
kwargs
):
def
update_submitted_state
(
sender
,
headers
,
**
kwargs
):
"""Add 'SUBMITTED' state to celery task."""
# the task may not exist if sent using `send_task` which
# sends tasks by name, so fall back to the default result backend
# if that is the case.
task
=
current_app
.
tasks
.
get
(
sender
)
backend
=
task
.
backend
if
task
else
current_app
.
backend
backend
.
store_result
(
kwargs
[
'headers'
][
'id'
],
None
,
"SUBMITTED"
)
backend
.
store_result
(
task_id
=
headers
[
'id'
],
result
=
None
,
state
=
'SUBMITTED'
)
def
make_celery
(
app
:
Flask
)
->
Celery
:
...
...
setup.py
View file @
5871d040
...
...
@@ -31,7 +31,6 @@ setup(
'PyYAML'
,
'pycryptodomex'
,
'rpy2'
,
'tzlocal'
,
'flake8'
,
'pytest'
,
'pytest-runner'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment