apscheduler_elab.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. jianye__house_hour = 6
  15. jianye_house_minute = 30
  16. jianye_brand_hour = 6
  17. jianye_brand_minute = 30
  18. # SECRET_KEY = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
  19. JSON_AS_ASCII = False
  20. JOBS = [
  21. {
  22. 'id': 'day_push',
  23. 'func': 'apscheduler_elab:Funcs.day_push',
  24. 'args': '',
  25. 'trigger': 'cron',
  26. 'day_of_week': '*',
  27. 'hour': 8,
  28. 'minute': 45
  29. },
  30. {
  31. 'id': 'week_push_one',
  32. 'func': 'apscheduler_elab:Funcs.week_push_one',
  33. 'args': '',
  34. 'trigger': 'cron',
  35. 'day_of_week': 'mon',
  36. 'hour': 9,
  37. 'minute': 50
  38. },
  39. {
  40. 'id': 'week_push_am_9',
  41. 'func': 'apscheduler_elab:Funcs.week_push_am_9',
  42. 'args': '',
  43. 'trigger': 'cron',
  44. 'day_of_week': 'mon',
  45. 'hour': 8,
  46. 'minute': 50
  47. },
  48. {
  49. 'id': 'week_push_two',
  50. 'func': 'apscheduler_elab:Funcs.week_push_two',
  51. 'args': '',
  52. 'trigger': 'cron',
  53. 'day_of_week': 'mon',
  54. 'hour': 10,
  55. 'minute': 50
  56. },
  57. {
  58. 'id': 'day_work_two',
  59. 'func': 'apscheduler_elab:Funcs.day_work_two',
  60. 'args': '',
  61. 'trigger': 'cron',
  62. 'day_of_week': '*',
  63. 'hour': 8,
  64. 'minute': 30
  65. },
  66. {
  67. 'id': 'day_work_three',
  68. 'func': 'apscheduler_elab:Funcs.day_work_three',
  69. 'args': '',
  70. 'trigger': 'cron',
  71. 'day_of_week': '*',
  72. 'hour': 8,
  73. 'minute': 30
  74. }
  75. ]
  76. # 线程池配置
  77. SCHEDULER_EXECUTORS = {
  78. 'default': {'type': 'threadpool', 'max_workers': 20}
  79. }
  80. SCHEDULER_JOB_DEFAULTS = {
  81. 'coalesce': False,
  82. 'max_instances': 5
  83. }
  84. # 调度器开关
  85. SCHEDULER_API_ENABLED = True
  86. pass
  87. class Funcs(object):
  88. @staticmethod
  89. def day_push():
  90. rp = ReportPush('bi_report')
  91. rp.report_push(1)
  92. @staticmethod
  93. def week_push_one():
  94. rp = ReportPush('bi_report')
  95. rp.report_push(2)
  96. @staticmethod
  97. def week_push_am_9():
  98. rp = ReportPush('bi_report')
  99. rp.report_push(21)
  100. @staticmethod
  101. def week_push_two():
  102. rp = ReportPush('bi_report')
  103. rp.report_push(3)
  104. @staticmethod
  105. def day_work_two():
  106. # rp = ReportPush('bi_report')
  107. # rp.report_push(4)
  108. print("run。。。")
  109. @staticmethod
  110. def day_work_three():
  111. # rp = ReportPush('bi_report')
  112. # rp.report_push_test(4)
  113. pass
  114. @staticmethod
  115. def day_work_5():
  116. jianye = JianYeReport()
  117. jianye.send_mail_to_customer(5)
  118. @staticmethod
  119. def day_work_6():
  120. jianye = JianYeReport()
  121. jianye.send_mail_to_customer(6)
  122. @staticmethod
  123. def day_work_7():
  124. jianye = JianYeReport()
  125. jianye.send_mail_to_customer(7)
  126. @staticmethod
  127. def day_work_8():
  128. jianye = JianYeReport()
  129. jianye.send_mail_to_customer(8)
  130. @staticmethod
  131. def day_work_9():
  132. jianye = JianYeReport()
  133. jianye.send_mail_to_customer(9)
  134. @staticmethod
  135. def day_work_10():
  136. jianye = JianYeReport()
  137. jianye.send_mail_to_customer(10)
  138. @staticmethod
  139. def day_work_11():
  140. jianye = JianYeReport()
  141. jianye.send_mail_to_customer(11)
  142. @staticmethod
  143. def day_work_12():
  144. jianye = JianYeReport()
  145. jianye.send_mail_to_customer(12)
  146. @staticmethod
  147. def minute_push_elab():
  148. # pdu = PandaUtil('linshi')
  149. # sql = 'select house_id, COUNT(house_id) as number from t_house_image group by house_id limit 5'
  150. # file_name = 'pandas_chart_columns2{}.xlsx'.format(time.time())
  151. # df_data = pdu.query_data(sql)
  152. # print(df_data.size)
  153. # pdu.panda_chart([df_data], 1, 'title x', 'title y', file_name)
  154. print('wwwww')
  155. if __name__ == '__main__':
  156. pass