forked from randsleadershipslack/destalinator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scheduler.py
32 lines (28 loc) · 862 Bytes
/
scheduler.py
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
from apscheduler.schedulers.blocking import BlockingScheduler
from warner import Warner
from archiver import Archiver
from announcer import Announcer
from flagger import Flagger
import os
sched = BlockingScheduler()
@sched.scheduled_job("cron", hour=4)
def destalinate_job():
print("Destalinating")
if "SB_TOKEN" not in os.environ or "API_TOKEN" not in os.environ:
print "ERR: Missing at least one Slack environment variable."
else:
warner = Warner()
archiver = Archiver()
announcer = Announcer()
flagger = Flagger()
print("Warning")
warner.warn()
print("Archiving")
archiver.archive()
print("Announcing")
announcer.announce()
print("Flagging")
flagger.flag()
print("OK: destalinated")
print("END: destalinate_job")
sched.start()