This repository was archived by the owner on Nov 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.py
More file actions
57 lines (43 loc) · 1.52 KB
/
manager.py
File metadata and controls
57 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import sys
import logging
log = logging.getLogger(__name__)
from app.app import app, rq
from app import jobs
from flask_script import Manager
from flask_rq2.script import RQManager
manager = Manager(app)
manager.add_command('rq', RQManager(rq))
@manager.option('-f', '--filename', dest='filename', default=None)
def warm_cache(filename):
import flanker
if filename:
if filename == '-':
f = sys.stdin
else:
f = open(filename)
log.info("flanker warmup mx cache {}".format(f.name))
for domain in f:
mx = flanker.addresslib.validate.mail_exchanger_lookup(domain, metrics=False)
log.info('{}, {}'.format(domain, mx))
else:
log.info("flanker warmup, no filename specified")
@manager.command
def queue_nightly_tasks():
log.info("queue_nightly_tasks")
jobs.validate_new_emails.queue()
jobs.validate_old_emails.queue()
@manager.command
def send_admin_report():
jobs.send_admin_report.queue()
@manager.option('-s', '--stage', dest='stage', default='briteverify')
def delete_crm_actions(stage):
from app.integrations import base_crm
crm_instance = base_crm.get_instance()
actions_to_delete = crm_instance.get_stage_actions(stage)
print "got",len(actions_to_delete),"actions to delete"
confirm = raw_input('This is a destructive action! Continue? (Y/N) ')
if confirm == 'Y':
for action in actions_to_delete:
crm_instance.delete_user_status(action['id'])
if __name__ == "__main__":
manager.run()