apscheduler_elab.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # -*- coding: utf-8 -*-
  2. from report_push import ReportPush
  3. from jianye_report import JianYeReport
  4. class Config(object):
  5. """
  6. 任务id对应的key
  7. day_push:1
  8. week_push_one:2
  9. week_push_two: 3
  10. day_work_two: 4
  11. day_work_three: 4
  12. day_work_four: 5
  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. 'id': 'day_work_four',
  62. 'func': 'apscheduler_elab:Funcs.day_work_four',
  63. 'args': '',
  64. 'trigger': 'cron',
  65. 'day_of_week': '*',
  66. 'hour': 6,
  67. 'minute': 45
  68. }
  69. ]
  70. # 线程池配置
  71. SCHEDULER_EXECUTORS = {
  72. 'default': {'type': 'threadpool', 'max_workers': 20}
  73. }
  74. SCHEDULER_JOB_DEFAULTS = {
  75. 'coalesce': False,
  76. 'max_instances': 3
  77. }
  78. # 调度器开关
  79. SCHEDULER_API_ENABLED = True
  80. pass
  81. class Funcs(object):
  82. @staticmethod
  83. def day_push():
  84. rp = ReportPush('bi_report')
  85. rp.report_push(1)
  86. @staticmethod
  87. def week_push_one():
  88. rp = ReportPush('bi_report')
  89. rp.report_push(2)
  90. @staticmethod
  91. def week_push_two():
  92. rp = ReportPush('bi_report')
  93. rp.report_push(3)
  94. @staticmethod
  95. def day_work_two():
  96. # rp = ReportPush('bi_report')
  97. # rp.report_push(4)
  98. print("run。。。")
  99. @staticmethod
  100. def day_work_three():
  101. rp = ReportPush('bi_report')
  102. rp.report_push_test(4)
  103. @staticmethod
  104. def day_work_four():
  105. jianye = JianYeReport()
  106. jianye.send_mail_to_customer(5)
  107. @staticmethod
  108. def minute_push_elab():
  109. # pdu = PandaUtil('linshi')
  110. # sql = 'select house_id, COUNT(house_id) as number from t_house_image group by house_id limit 5'
  111. # file_name = 'pandas_chart_columns2{}.xlsx'.format(time.time())
  112. # df_data = pdu.query_data(sql)
  113. # print(df_data.size)
  114. # pdu.panda_chart([df_data], 1, 'title x', 'title y', file_name)
  115. print('wwwww')
  116. if __name__ == '__main__':
  117. pass