def maint_variable_data(dbo): try: configuration.set_variable_data_updated_blank(dbo) animal.update_all_variable_animal_data(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: uncaught error running maint_variable_data: %s" % em, "cron.maint_variable_data", dbo, sys.exc_info())
def maint_variable_data(dbo): try: configuration.set_variable_data_updated_blank(dbo) animal.update_all_variable_animal_data(dbo, True) except: em = str(sys.exc_info()[0]) al.error("FAIL: uncaught error running maint_variable_data: %s" % em, "cron.maint_variable_data", dbo, sys.exc_info())
def maint_animal_figures(dbo): try: animal.update_all_animal_statuses(dbo) animal.update_all_variable_animal_data(dbo) animal.maintenance_animal_figures(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: uncaught error running maint_animal_figures: %s" % em, "cron.maint_animal_figures", dbo, sys.exc_info())
def maint_animal_figures(dbo): try: animal.update_all_animal_statuses(dbo) animal.update_all_variable_animal_data(dbo) animal.maintenance_animal_figures(dbo, includeMonths = True, includeAnnual = True) except: em = str(sys.exc_info()[0]) al.error("FAIL: uncaught error running maint_animal_figures: %s" % em, "cron.maint_animal_figures", dbo, sys.exc_info())
def daily(dbo): """ Tasks to run once each day before users login for the day. """ al.info("start daily tasks", "cron.daily", dbo) try: # The batch should never be run at a time when users may be # using the system, remove any database update locks as any # lock at this time should be erroneous configuration.db_unlock(dbo) # Check to see if any updates need performing on this database if dbupdate.check_for_updates(dbo): dbupdate.perform_updates(dbo) if dbupdate.check_for_view_seq_changes(dbo): dbupdate.install_db_views(dbo) dbupdate.install_db_sequences(dbo) # Get the latest news from sheltermanager.com dbfs.update_asm_news(dbo) # Shouldn't be anyone logged in at this point users.auto_logout(dbo) # Update on shelter and foster animal location fields animal.update_on_shelter_animal_statuses(dbo) animal.update_foster_animal_statuses(dbo) # Update all animal variable data (age, time on shelter, etc) animal.update_all_variable_animal_data(dbo) # Update animal figures for reports animal.update_animal_figures(dbo) animal.update_animal_figures_annual(dbo) animal.update_animal_figures_asilomar(dbo) # Update animal litter counts animal.update_active_litters(dbo) # Find any missing person geocodes person.update_missing_geocodes(dbo) # Clear out any old audit logs audit.clean(dbo) # Remove old publisher logs dbfs.delete_old_publish_logs(dbo) # auto cancel any reservations movement.auto_cancel_reservations(dbo) # auto cancel animal holds animal.auto_cancel_holds(dbo) # auto remove online forms onlineform.auto_remove_old_incoming_forms(dbo) # Update waiting list urgencies and auto remove waitinglist.auto_remove_waitinglist(dbo) waitinglist.auto_update_urgencies(dbo) # See if any new PDFs have been attached that we can scale down media.check_and_scale_pdfs(dbo) # Email diary notes to users diary.email_uncompleted_upto_today(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running batch tasks: %s" % em, "cron.daily", dbo, sys.exc_info()) # We're done, hurrah! al.info("end daily tasks", "cron.daily", dbo)
def test_update_all_variable_animal_data(self): base.execute( "DELETE FROM configuration WHERE ItemName LIKE 'VariableAnimalDataUpdated'" ) animal.update_all_variable_animal_data(base.get_dbo())
def daily(dbo): """ Tasks to run once each day before users login for the day. """ al.info("start daily tasks", "cron.daily", dbo) try: # The batch should never be run at a time when users may be # using the system, remove any database update locks as any # lock at this time should be erroneous configuration.db_unlock(dbo) try: # Check to see if any updates need performing on this database if dbupdate.check_for_updates(dbo): dbupdate.perform_updates(dbo) if dbupdate.check_for_view_seq_changes(dbo): dbupdate.install_db_views(dbo) dbupdate.install_db_sequences(dbo) # Get the latest news from sheltermanager.com dbfs.update_asm_news(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running database preparation tasks: %s" % em, "cron.daily", dbo, sys.exc_info()) try: # Update on shelter and foster animal location fields animal.update_on_shelter_animal_statuses(dbo) animal.update_foster_animal_statuses(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running animal update tasks: %s" % em, "cron.daily", dbo, sys.exc_info()) try: # Update all animal variable data (age, time on shelter, etc) animal.update_all_variable_animal_data(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running variable data update: %s" % em, "cron.daily", dbo, sys.exc_info()) try: # Update animal figures for reports animal.update_animal_figures(dbo) animal.update_animal_figures_annual(dbo) animal.update_animal_figures_asilomar(dbo) animal.update_animal_figures_monthly_asilomar(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running animal figures: %s" % em, "cron.daily", dbo, sys.exc_info()) try: # Update waiting list urgencies and auto remove waitinglist.auto_remove_waitinglist(dbo) waitinglist.auto_update_urgencies(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running waiting list tasks: %s" % em, "cron.daily", dbo, sys.exc_info()) # Email diary notes to users diary.email_uncompleted_upto_today(dbo) # Update animal litter counts animal.update_active_litters(dbo) # Find any missing person geocodes person.update_missing_geocodes(dbo) # Clear out any old audit logs audit.clean(dbo) # Remove old publisher logs dbfs.delete_old_publish_logs(dbo) # auto cancel any reservations movement.auto_cancel_reservations(dbo) # auto cancel animal holds animal.auto_cancel_holds(dbo) # auto remove online forms onlineform.auto_remove_old_incoming_forms(dbo) # See if any new PDFs have been attached that we can scale down if SCALE_PDF_DURING_BATCH: media.check_and_scale_pdfs(dbo) except: em = str(sys.exc_info()[0]) al.error("FAIL: running batch tasks: %s" % em, "cron.daily", dbo, sys.exc_info()) # We're done, hurrah! al.info("end daily tasks", "cron.daily", dbo)
def test_update_all_variable_animal_data(self): base.execute("DELETE FROM configuration WHERE ItemName LIKE 'VariableAnimalDataUpdated'") animal.update_all_variable_animal_data(base.get_dbo())