def start_process(): try: print("***********Initiate Process - mint**************") database_log.process_log("India - mint : start_process", "Initiate Process") while True: scheduled_sleeping_seconds = app_config.india_market_scheduled_task_sleeping loader.start_load_process(lookup_value) database_log.process_log("India - mint : start_process", "Re-Run Process") print("Last run was successful for India - mint, next run in {} seconds.".format(scheduled_sleeping_seconds)) time.sleep(scheduled_sleeping_seconds) except Exception as error: database_log.error_log("India - mint : start_process", error)
def start_process(): try: print("***********Initiate Process - business_today**************") database_log.process_log("India - business_today : start_process", "Initiate Process") while True: # Checks whether a scheduled task - is pending to run or not scheduled_sleeping_seconds = app_config.india_market_scheduled_task_sleeping loader.start_load_process(lookup_value) database_log.process_log("India - business_today : start_process", "Re-Run Process") print( "Last run was successful for India - business_today, next run in {} seconds." .format(scheduled_sleeping_seconds)) time.sleep(scheduled_sleeping_seconds) except Exception as error: database_log.error_log("India - business_today : start_process", error)
def call_loader(): loader.fetch_stock_data() def cancel_job(): schedule.cancel_job(job) print(schedule.jobs) # shows empty list, as they are no open jobs time.sleep(5) # just to double check that it does no longer trigger def start_scheduler(): call_loader() if __name__ == "__main__": print("***********Initiate Process - Indices**************") database_log.process_log("Indices - start_process", "Initiate Process") while True: scheduled_sleeping_seconds = app_config.indices_scheduled_task_sleeping # load indices data call_loader() print( "Last run was successful for Indices - Data load, next run in {} seconds." .format(scheduled_sleeping_seconds)) database_log.process_log("Indices - start_process", "Re-Run Process") time.sleep(scheduled_sleeping_seconds)