apscheduler_elab.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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': 00
  49. },
  50. {
  51. 'id': 'day_work_three',
  52. 'func': 'apscheduler_elab:Funcs.day_work_three',
  53. 'args': '',
  54. 'trigger': 'cron',
  55. 'day_of_week': '*',
  56. 'hour': 21,
  57. 'minute': 20
  58. }
  59. ]
  60. # 线程池配置
  61. SCHEDULER_EXECUTORS = {
  62. 'default': {'type': 'threadpool', 'max_workers': 20}
  63. }
  64. SCHEDULER_JOB_DEFAULTS = {
  65. 'coalesce': False,
  66. 'max_instances': 3
  67. }
  68. # 调度器开关
  69. SCHEDULER_API_ENABLED = True
  70. pass
  71. class Funcs(object):
  72. @staticmethod
  73. def day_push():
  74. rp = ReportPush('bi_report')
  75. rp.report_push(1)
  76. @staticmethod
  77. def week_push_one():
  78. rp = ReportPush('bi_report')
  79. rp.report_push(2)
  80. @staticmethod
  81. def week_push_two():
  82. rp = ReportPush('bi_report')
  83. rp.report_push(3)
  84. @staticmethod
  85. def day_work_two():
  86. rp = ReportPush('bi_report')
  87. rp.report_push(4)
  88. @staticmethod
  89. def day_work_three():
  90. rp = ReportPush('bi_report')
  91. rp.report_push_test(4)
  92. @staticmethod
  93. def minute_push_elab():
  94. # pdu = PandaUtil('linshi')
  95. # sql = 'select house_id, COUNT(house_id) as number from t_house_image group by house_id limit 5'
  96. # file_name = 'pandas_chart_columns2{}.xlsx'.format(time.time())
  97. # df_data = pdu.query_data(sql)
  98. # print(df_data.size)
  99. # pdu.panda_chart([df_data], 1, 'title x', 'title y', file_name)
  100. print('wwwww')
  101. if __name__ == '__main__':
  102. pass