def longtask(): task = long_task.apply_async() #aqui task sera 'long_task' return jsonify({}), 202, { 'Location': url_for( 'taskstatus', # regresara jsonify con 202 para decir que esta trabajando task_id=task.id) }
def longtask(): task = long_task.apply_async() return jsonify({}), 202, { 'Location': url_for('taskstatus', task_id=task.id) }
from tasks import add, fail, long_task tsk = long_task.apply_async(args=[23]) resp = long_task.AsyncResult(tsk.id) result = add.delay(4, 4) result.apply_async result.ready() result.get(timeout=1) result.get(propagate=False) result.traceback result = fail.delay(4) result.ready() result.get(timeout=1) result.get(propagate=False) result.traceback
'rate_limit': '10/m' }, reply=True) print('Reply: %s' % reply) # revoke a task result = long_task.delay() time.sleep(3) # below is equal to: result.revoke() app.control.revoke(result.task_id, terminate=True) # time limit don’t currently work on platforms that don’t support the SIGUSR1 signal. # so it cannot work on Windows. reply = app.control.time_limit('tasks.long_task', soft=10, hard=20, reply=True) print('Reply: %s' % reply) long_task.apply_async() # add consumer reply = app.control.add_consumer( queue='baz', exchange='ex', exchange_type='topic', routing_key='media.*', options={ 'queue_durable': False, 'exchange_durable': False, }, reply=True ) print('Reply: %s' % reply)
def start_celery_long_task(): long_task.apply_async((10, 'task-1', '/managers'))
def longtask(): task = long_task.apply_async() return jsonify({}), 202, {'Location': url_for('home.taskstatus', task_id=task.id)}