def expire_submissions_task(): flag = True log.debug("Starting check for expired subs.") #Sleep for some time to allow other processes to get ahead/behind time_sleep_value = random.uniform(0, 100) time.sleep(time_sleep_value) try: gc.collect() db.reset_queries() transaction.commit() #Comment out submission expiration for now. Not really needed while testing. expire_submissions.reset_timed_out_submissions() """ expired_list = expire_submissions.get_submissions_that_have_expired(subs) if len(expired_list) > 0: success = grader_util.finalize_expired_submissions(expired_list) statsd.increment("open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:{0}".format(success)]) """ try: expire_submissions.reset_ml_subs_to_in() transaction.commit() except Exception: log.exception("Could not reset ml to in!") try: expire_submissions.reset_skipped_subs() transaction.commit() except Exception: log.exception("Could not reset skipped submissions!") try: generate_student_metrics.regenerate_student_data() transaction.commit() except Exception: log.exception("Could not regenerate student data!") try: #Remove old ML grading models expire_submissions.remove_old_model_files() transaction.commit() except Exception: log.exception("Could not remove ml grading models!") log.debug("Finished looping through.") except Exception as err: log.exception("Could not get submissions to expire! Error: {0}".format(err)) statsd.increment("open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:Exception"]) util.log_connection_data() transaction.commit()
def expire_submissions_task(): flag = True log.debug("Starting check for expired subs.") #Sleep for some time to allow other processes to get ahead/behind time_sleep_value = random.uniform(0, 100) time.sleep(time_sleep_value) try: gc.collect() db.reset_queries() transaction.commit() subs = Submission.objects.all() #Comment out submission expiration for now. Not really needed while testing. expire_submissions.reset_timed_out_submissions(subs) """ expired_list = expire_submissions.get_submissions_that_have_expired(subs) if len(expired_list) > 0: success = grader_util.finalize_expired_submissions(expired_list) statsd.increment("open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:{0}".format(success)]) """ try: expire_submissions.reset_in_subs_to_ml(subs) transaction.commit() except: log.exception("Could not reset in to ml!") try: expire_submissions.reset_subs_in_basic_check(subs) transaction.commit() except: log.exception("Could reset subs in basic check!") try: expire_submissions.reset_failed_subs_in_basic_check(subs) transaction.commit() except: log.exception("Could not reset failed subs in basic check!") try: expire_submissions.reset_ml_subs_to_in() transaction.commit() except: log.exception("Could not reset ml to in!") try: #See if duplicate peer grading items have been finished grading expire_submissions.add_in_duplicate_ids() transaction.commit() except: log.exception("Could not finish checking for duplicate ids!") try: #See if duplicate peer grading items have been finished grading expire_submissions.check_if_grading_finished_for_duplicates() transaction.commit() except: log.exception("Could not finish checking if duplicates are graded!") try: #Mark submissions as duplicates if needed expire_submissions.mark_student_duplicate_submissions() transaction.commit() except: log.exception("Could not mark subs as duplicate!") try: generate_student_metrics.regenerate_student_data() transaction.commit() except: log.exception("Could not regenerate student data!") try: #Remove old ML grading models expire_submissions.remove_old_model_files() transaction.commit() except: log.exception("Could not remove ml grading models!") log.debug("Finished looping through.") except Exception as err: log.exception("Could not get submissions to expire! Error: {0}".format(err)) statsd.increment("open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:Exception"]) transaction.commit()
def expire_submissions_task(): flag = True log.debug("Starting check for expired subs.") #Sleep for some time to allow other processes to get ahead/behind time_sleep_value = random.uniform(0, 100) time.sleep(time_sleep_value) try: gc.collect() db.reset_queries() transaction.commit() subs = Submission.objects.all() #Comment out submission expiration for now. Not really needed while testing. expire_submissions.reset_timed_out_submissions(subs) """ expired_list = expire_submissions.get_submissions_that_have_expired(subs) if len(expired_list) > 0: success = grader_util.finalize_expired_submissions(expired_list) statsd.increment("open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:{0}".format(success)]) """ try: expire_submissions.reset_in_subs_to_ml(subs) transaction.commit() except: log.exception("Could not reset in to ml!") try: expire_submissions.reset_subs_in_basic_check(subs) transaction.commit() except: log.exception("Could reset subs in basic check!") try: expire_submissions.reset_failed_subs_in_basic_check(subs) transaction.commit() except: log.exception("Could not reset failed subs in basic check!") try: expire_submissions.reset_ml_subs_to_in() transaction.commit() except: log.exception("Could not reset ml to in!") try: #See if duplicate peer grading items have been finished grading expire_submissions.add_in_duplicate_ids() transaction.commit() except: log.exception("Could not finish checking for duplicate ids!") try: #See if duplicate peer grading items have been finished grading expire_submissions.check_if_grading_finished_for_duplicates() transaction.commit() except: log.exception( "Could not finish checking if duplicates are graded!") try: #Mark submissions as duplicates if needed expire_submissions.mark_student_duplicate_submissions() transaction.commit() except: log.exception("Could not mark subs as duplicate!") try: generate_student_metrics.regenerate_student_data() transaction.commit() except: log.exception("Could not regenerate student data!") try: #Remove old ML grading models expire_submissions.remove_old_model_files() transaction.commit() except: log.exception("Could not remove ml grading models!") log.debug("Finished looping through.") except Exception as err: log.exception( "Could not get submissions to expire! Error: {0}".format(err)) statsd.increment( "open_ended_assessment.grading_controller.remove_expired_subs", tags=["success:Exception"]) transaction.commit()