| 1 |
from celery import Celery |
| 2 |
from celery.worker.control import control_command, inspect_command |
| 3 |
|
| 4 |
|
| 5 |
@control_command( |
| 6 |
args=[('a', int), ('b', int)], |
| 7 |
signature='a b', |
| 8 |
) |
| 9 |
def custom_control_cmd(state, a, b): |
| 10 |
"""Ask the workers to reply with a and b.""" |
| 11 |
return {'ok': f'Received {a} and {b}'} |
| 12 |
|
| 13 |
|
| 14 |
@inspect_command( |
| 15 |
args=[('x', int)], |
| 16 |
signature='x', |
| 17 |
) |
| 18 |
def custom_inspect_cmd(state, x): |
| 19 |
"""Ask the workers to reply with x.""" |
| 20 |
return {'ok': f'Received {x}'} |
| 21 |
|
| 22 |
|
| 23 |
app = Celery(set_as_current=False) |
| 24 |
app.config_from_object('t.integration.test_worker_config') |