def requeue_submissions(self, open_submissions): for open_submission in open_submissions: log.info(" [ ] Requeuing submission.id=%d to queue '%s'" %\ (open_submission.id, open_submission.queue_name)) qitem = str(open_submission.id) open_submission.pull_time = None open_submission.pullkey = '' push_to_queue(open_submission.queue_name, qitem) open_submission.save()
def requeue_submissions(self, submission_qset): num_submissions = submission_qset.count() if num_submissions == 0: self.stdout.write("No matching submissions to queue.") return self.stdout.write("Queueing {0} submissions...".format(num_submissions)) for submission in submission_qset: if submission.pull_time: submission.num_failures += 1 submission.pull_time = None submission.pullkey = '' submission.save() push_to_queue(submission.queue_name, str(submission.id)) self.stdout.write("Queueing finished")
def requeue_submissions(self, submission_qset): num_submissions = submission_qset.count() if num_submissions == 0: self.stdout.write("No matching submissions to queue.") return self.stdout.write( "Queueing {0} submissions...".format(num_submissions)) for submission in submission_qset: if submission.pull_time: submission.num_failures += 1 submission.pull_time = None submission.pullkey = '' submission.save() push_to_queue(submission.queue_name, str(submission.id)) self.stdout.write("Queueing finished")
def requeue_submissions(self, open_submissions): for open_submission in open_submissions: current_time = timezone.now() time_difference = (current_time - open_submission.pull_time).total_seconds() if time_difference > settings.PULLED_SUBMISSION_TIMEOUT: open_submission.num_failures += 1 if open_submission.num_failures < settings.MAX_NUMBER_OF_FAILURES: log.info(" [ ] Requeuing submission.id=%d to queue '%s' which has been outstanding for %d seconds" %\ (open_submission.id, open_submission.queue_name, time_difference)) qitem = str(open_submission.id) open_submission.pull_time = None open_submission.pullkey = '' push_to_queue(open_submission.queue_name, qitem) else: log.info(" [ ] NOT requeueing submission.id=%d to queue '%s' because num_failures=%d >= MAX_NUMBER_OF_FAILURES=%d" %\ (open_submission.id, open_submission.queue_name, open_submission.num_failures, settings.MAX_NUMBER_OF_FAILURES)) open_submission.save()