apscheduler_elab.py 2.8 KB

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