def run(self, update_article_info, callback=None): try: image_tobedone_key = generate_image_tobedone_key(update_article_info.article_id) set_image_tobedone(image_tobedone_key, len(update_article_info.image_url_list)) except Exception: pass else: # call next step if update_article_info.image_url_list: tasks = [] for image_url in update_article_info.image_url_list: image_task = subtask(callback) # hack into this subtask to change its 'args' image_task['args'] = (image_url, image_tobedone_key, update_article_info) tasks.append(image_task) image_job = TaskSet(tasks=tasks) image_job.apply_async() else: mark_article_as_done(update_article_info) return None
def run(self, update_image_info, update_article_info): decrease_image_tobedone(update_image_info.image_tobedone_key) if get_image_tobedone(update_image_info.image_tobedone_key) == 0: mark_article_as_done(update_article_info) return None