apscheduler_elab.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. 'id': 'day_work_6',
  71. 'func': 'apscheduler_elab:Funcs.day_work_6',
  72. 'args': '',
  73. 'trigger': 'cron',
  74. 'day_of_week': '*',
  75. 'hour': 6,
  76. 'minute': 45
  77. },
  78. {
  79. 'id': 'day_work_7',
  80. 'func': 'apscheduler_elab:Funcs.day_work_7',
  81. 'args': '',
  82. 'trigger': 'cron',
  83. 'day_of_week': '*',
  84. 'hour': 6,
  85. 'minute': 45
  86. },
  87. {
  88. 'id': 'day_work_8',
  89. 'func': 'apscheduler_elab:Funcs.day_work_8',
  90. 'args': '',
  91. 'trigger': 'cron',
  92. 'day_of_week': '*',
  93. 'hour': 6,
  94. 'minute': 45
  95. },
  96. {
  97. 'id': 'day_work_9',
  98. 'func': 'apscheduler_elab:Funcs.day_work_9',
  99. 'args': '',
  100. 'trigger': 'cron',
  101. 'day_of_week': '*',
  102. 'hour': 6,
  103. 'minute': 45
  104. },
  105. {
  106. 'id': 'day_work_10',
  107. 'func': 'apscheduler_elab:Funcs.day_work_10',
  108. 'args': '',
  109. 'trigger': 'cron',
  110. 'day_of_week': '*',
  111. 'hour': 6,
  112. 'minute': 45
  113. },
  114. {
  115. 'id': 'day_work_11',
  116. 'func': 'apscheduler_elab:Funcs.day_work_11',
  117. 'args': '',
  118. 'trigger': 'cron',
  119. 'day_of_week': '*',
  120. 'hour': 6,
  121. 'minute': 45
  122. }
  123. ]
  124. # 线程池配置
  125. SCHEDULER_EXECUTORS = {
  126. 'default': {'type': 'threadpool', 'max_workers': 20}
  127. }
  128. SCHEDULER_JOB_DEFAULTS = {
  129. 'coalesce': False,
  130. 'max_instances': 3
  131. }
  132. # 调度器开关
  133. SCHEDULER_API_ENABLED = True
  134. pass
  135. class Funcs(object):
  136. @staticmethod
  137. def day_push():
  138. rp = ReportPush('bi_report')
  139. rp.report_push(1)
  140. @staticmethod
  141. def week_push_one():
  142. rp = ReportPush('bi_report')
  143. rp.report_push(2)
  144. @staticmethod
  145. def week_push_two():
  146. rp = ReportPush('bi_report')
  147. rp.report_push(3)
  148. @staticmethod
  149. def day_work_two():
  150. # rp = ReportPush('bi_report')
  151. # rp.report_push(4)
  152. print("run。。。")
  153. @staticmethod
  154. def day_work_three():
  155. rp = ReportPush('bi_report')
  156. rp.report_push_test(4)
  157. @staticmethod
  158. def day_work_four():
  159. jianye = JianYeReport()
  160. jianye.send_mail_to_customer(5)
  161. @staticmethod
  162. def day_work_6():
  163. jianye = JianYeReport()
  164. jianye.send_mail_to_customer(6)
  165. @staticmethod
  166. def day_work_7():
  167. jianye = JianYeReport()
  168. jianye.send_mail_to_customer(7)
  169. @staticmethod
  170. def day_work_8():
  171. jianye = JianYeReport()
  172. jianye.send_mail_to_customer(8)
  173. @staticmethod
  174. def day_work_9():
  175. jianye = JianYeReport()
  176. jianye.send_mail_to_customer(9)
  177. @staticmethod
  178. def day_work_10():
  179. jianye = JianYeReport()
  180. jianye.send_mail_to_customer(10)
  181. @staticmethod
  182. def day_work_11():
  183. jianye = JianYeReport()
  184. jianye.send_mail_to_customer(11)
  185. @staticmethod
  186. def minute_push_elab():
  187. # pdu = PandaUtil('linshi')
  188. # sql = 'select house_id, COUNT(house_id) as number from t_house_image group by house_id limit 5'
  189. # file_name = 'pandas_chart_columns2{}.xlsx'.format(time.time())
  190. # df_data = pdu.query_data(sql)
  191. # print(df_data.size)
  192. # pdu.panda_chart([df_data], 1, 'title x', 'title y', file_name)
  193. print('wwwww')
  194. if __name__ == '__main__':
  195. pass