logger = logging.getLogger(__name__) sched = BackgroundScheduler() @sched.scheduled_job('cron', hour=18, minute=00) def scheduled_job1(): crawl_finance_data('000001', '666666') es_connector.finance_sheet_to_es() es_connector.finance_event_to_es(event_type='finance_report') @sched.scheduled_job('cron', hour=18, minute=10) def scheduled_job2(): process_crawl(StockForecastSpider) es_connector.finance_event_to_es(event_type='finance_forecast') if __name__ == '__main__': logger.info("start crawling finance data") crawl_finance_data('000001', '666666') process_crawl(StockForecastSpider) logger.info("shed crawling finance data") sched.start() logger.info("I would crawl finance data at 18:00") sched._thread.join()
def scheduled_job1(): crawl_finance_data('000001', '666666') es_connector.finance_sheet_to_es() es_connector.finance_event_to_es(event_type='finance_report')
def scheduled_job1(): crawl_finance_data('000001', '666666')
def _download_finance_data_if_need(the_path, the_code): if not os.path.exists(the_path): from fooltrader.datamanager.china_stock_manager import crawl_finance_data logger.info("try to download the finance data at first") crawl_finance_data(start_code=the_code, end_code=the_code)
def scheduled_job3(): crawl_finance_data('600000', '666666')
def scheduled_job2(): crawl_finance_data('300000', '300999')
def scheduled_job1(): crawl_finance_data('000001', '002999')