python - How to update Celery Task ETA? -
i building simple waiting list app in django 1.10.3 using celery 4.1.0.
i have following base tasks:
@shared_task def start_user_counter(): logging.info('task executed @ {}'.format(datetime.datetime.utcnow())) # task executed when user reaches top of queue. # send email, perform other stuff in here ... @shared_task def update_queue(): curr_time = datetime.datetime.utcnow() logging.info('task called @ {}'.format(curr_time)) time_to_exec = curr_time + datetime.timedelta(seconds=10) # here, perform checks if task exists in redis # if not exist - create new 1 , store redis # if exist - update task's eta. task_id = start_user_counter.apply_async(eta=time_to_exec) logging.info('task id: {}'.format(task_id)) # ... update_queue.delay()
each task represents 1 user on waiting list. new user assigned eta when suppose removed waiting list (he reached top @ eta). however, each user has possibility speed time when reach top of waiting list.
question: how can update eta of existing task execcutes earlier first anticipated?
wiki
Comments
Post a Comment