apscheduler_elab.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # -*- coding: utf-8 -*-
  2. from panda_util import PandaUtil
  3. import time
  4. from report_push import ReportPush
  5. class Config(object):
  6. """
  7. 任务id对应的key
  8. day_push:1
  9. week_push_one:2
  10. week_push_two: 3
  11. day_work_two: 4
  12. """
  13. JOBS = [
  14. {
  15. 'id': 'day_push',
  16. 'func': 'apscheduler_elab:Funcs.day_push',
  17. 'args': '',
  18. 'trigger': 'cron',
  19. 'day_of_week': '*',
  20. 'hour': 8,
  21. 'minute': 45
  22. },
  23. {
  24. 'id': 'week_push_one',
  25. 'func': 'apscheduler_elab:Funcs.week_push_one',
  26. 'args': '',
  27. 'trigger': 'cron',
  28. 'day_of_week': 'mon',
  29. 'hour': 9,
  30. 'minute': 50
  31. },
  32. {
  33. 'id': 'week_push_two',
  34. 'func': 'apscheduler_elab:Funcs.week_push_two',
  35. 'args': '',
  36. 'trigger': 'cron',
  37. 'day_of_week': 'mon',
  38. 'hour': 10,
  39. 'minute': 50
  40. },
  41. {
  42. 'id': 'day_work_two',
  43. 'func': 'apscheduler_elab:Funcs.day_work_two',
  44. 'args': '',
  45. 'trigger': 'cron',
  46. 'day_of_week': '*',
  47. 'hour': 8,
  48. 'minute': 50
  49. }
  50. ]
  51. # 线程池配置
  52. SCHEDULER_EXECUTORS = {
  53. 'default': {'type': 'threadpool', 'max_workers': 20}
  54. }
  55. SCHEDULER_JOB_DEFAULTS = {
  56. 'coalesce': False,
  57. 'max_instances': 3
  58. }
  59. # 调度器开关
  60. SCHEDULER_API_ENABLED = True
  61. pass
  62. class Funcs(object):
  63. @staticmethod
  64. def day_push():
  65. rp = ReportPush('bi_report')
  66. rp.report_push(1)
  67. @staticmethod
  68. def week_push_one():
  69. rp = ReportPush('bi_report')
  70. rp.report_push(2)
  71. @staticmethod
  72. def week_push_two():
  73. rp = ReportPush('bi_report')
  74. rp.report_push(3)
  75. @staticmethod
  76. def day_work_two():
  77. rp = ReportPush('bi_report')
  78. rp.report_push(4)
  79. @staticmethod
  80. def day_work_three():
  81. rp = ReportPush('bi_report')
  82. rp.report_push(4)
  83. @staticmethod
  84. def minute_push_elab():
  85. # pdu = PandaUtil('linshi')
  86. # sql = 'select house_id, COUNT(house_id) as number from t_house_image group by house_id limit 5'
  87. # file_name = 'pandas_chart_columns2{}.xlsx'.format(time.time())
  88. # df_data = pdu.query_data(sql)
  89. # print(df_data.size)
  90. # pdu.panda_chart([df_data], 1, 'title x', 'title y', file_name)
  91. print('wwwww')
  92. if __name__ == '__main__':
  93. pass