-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Milestone
Description
Checklist
- I have read the relevant section in the
contribution guide
on reporting bugs. - I have checked the issues list
for similar or identical bug reports.
Mandatory Debugging Information
- I have included the output of
celery -A proj reportin the issue.
(if you are not able to do this, then at least specify the Celery
version affected). - I have included all the versions of all the external dependencies required
to reproduce this bug.
Optional Debugging Information
- I have tried reproducing the issue after downgrading
and/or upgrading Celery and its dependencies.
Steps to Reproduce
Required Dependencies
- Minimal Python Version: 3.5.3
- Minimal Celery Version: 4.3.0
- Minimal Kombu Version: 4.6.1
- Minimal Broker Version: 3.6.6-1
- Minimal OS and/or Kernel Version: Debian 4.9.168-1+deb9u2
Minimally Reproducible Test Case
Details
from kombu import Queue, Exchange
from celery import Celery
import time
broker = "amqp://admin:admin@localhost:5672/mqfrontend"
app = Celery(
"test celery",
broker=broker
)
app.conf.accept_content = ['json']
app.conf.task_serializer = 'json'
app.conf.result_serializer = 'json'
app.conf.task_ignore_result = True
app.conf.task_routes = {'frontend.*': {'queue': 'first_task', 'routing_key': 'frontend.first_task'}}
app.conf.task_queues = (
Queue('first_task', routing_key='frontend.first_task', queue_arguments={'x-max-priority': 10}),
)
@app.task(name="frontend.first_task", bind=True)
def priority_task(self, arg):
time.sleep(2)
print("PRIORITY: i:%s, p:%s"%(arg, self.request.delivery_info['priority']))
return self.request.delivery_info['priority']
@app.task(name="frontend.second_task", bind=True)
def priorityb_task(self, _, arg):
time.sleep(2)
print("PRIORITYB: i:%s, p:%s"%(arg, self.request.delivery_info['priority']))
return "Test%s"%self.request.delivery_info['priority']
if __name__=='__main__':
import celery
s = celery.chain(
app.signature(
"frontend.first_task",
args=(5,),
priority=5
),
app.signature(
"frontend.second_task",
args=(5,),
priority=5
)
)
s.delay()Expected Behavior
We expect first_task and second_task to have a priority of 5 (it works with celery 4.2.1)
Expected output:
[tasks]
. frontend.first_task
. frontend.second_task
[2019-06-14 09:24:30,628: INFO/MainProcess] Connected to amqp://admin:**@127.0.0.1:5672/mqfrontend
[2019-06-14 09:24:30,640: INFO/MainProcess] mingle: searching for neighbors
[2019-06-14 09:24:31,673: INFO/MainProcess] mingle: sync with 1 nodes
[2019-06-14 09:24:31,674: INFO/MainProcess] mingle: sync complete
[2019-06-14 09:24:31,717: INFO/MainProcess] celery@ocean ready.
[2019-06-14 09:24:33,799: INFO/MainProcess] Received task: frontend.first_task[1c311ee3-436a-44a0-b849-fa938ec9be96]
[2019-06-14 09:24:35,802: WARNING/ForkPoolWorker-1] PRIORITY: i:5, p:5
[2019-06-14 09:24:35,818: INFO/ForkPoolWorker-1] Task frontend.first_task[1c311ee3-436a-44a0-b849-fa938ec9be96] succeeded in 2.01777482801117s: 5
[2019-06-14 09:24:35,819: INFO/MainProcess] Received task: frontend.second_task[fb1f1871-4b24-4f22-8ead-da74f24285d1]
[2019-06-14 09:24:37,822: WARNING/ForkPoolWorker-1] PRIORITYB: i:5, p:5
[2019-06-14 09:24:37,822: INFO/ForkPoolWorker-1] Task frontend.second_task[fb1f1871-4b24-4f22-8ead-da74f24285d1] succeeded in 2.0030388499144465s: 'Test0'
Actual Behavior
first_task has the priority of 5, but second_task has no priority.
Actual output:
[tasks]
. frontend.first_task
. frontend.second_task
[2019-06-14 09:24:30,628: INFO/MainProcess] Connected to amqp://admin:**@127.0.0.1:5672/mqfrontend
[2019-06-14 09:24:30,640: INFO/MainProcess] mingle: searching for neighbors
[2019-06-14 09:24:31,673: INFO/MainProcess] mingle: sync with 1 nodes
[2019-06-14 09:24:31,674: INFO/MainProcess] mingle: sync complete
[2019-06-14 09:24:31,717: INFO/MainProcess] celery@ocean ready.
[2019-06-14 09:24:33,799: INFO/MainProcess] Received task: frontend.first_task[1c311ee3-436a-44a0-b849-fa938ec9be96]
[2019-06-14 09:24:35,802: WARNING/ForkPoolWorker-1] PRIORITY: i:5, p:5
[2019-06-14 09:24:35,818: INFO/ForkPoolWorker-1] Task frontend.first_task[1c311ee3-436a-44a0-b849-fa938ec9be96] succeeded in 2.01777482801117s: 5
[2019-06-14 09:24:35,819: INFO/MainProcess] Received task: frontend.second_task[fb1f1871-4b24-4f22-8ead-da74f24285d1]
[2019-06-14 09:24:37,822: WARNING/ForkPoolWorker-1] PRIORITYB: i:5, p:0
[2019-06-14 09:24:37,822: INFO/ForkPoolWorker-1] Task frontend.second_task[fb1f1871-4b24-4f22-8ead-da74f24285d1] succeeded in 2.0030388499144465s: 'Test0'
neozhangthe1, ch0k0bn, NikoNagy and AVKashtanov