This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
forked from kippdc/whetstone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
71 lines (63 loc) · 1.9 KB
/
main.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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import logging
import os
import sys
import traceback
import whetstone
from sqlsorcery import MSSQL
from mailer import Mailer
def configure_logging():
logging.basicConfig(
handlers=[
logging.FileHandler(filename="data/app.log", mode="w+"),
logging.StreamHandler(sys.stdout),
],
level=logging.DEBUG,
format="%(asctime)s | %(levelname)s: %(message)s",
datefmt="%Y-%m-%d %I:%M:%S%p %Z",
)
logging.getLogger("requests").setLevel(logging.ERROR)
logging.getLogger("urllib3").setLevel(logging.ERROR)
def main():
configure_logging()
sql = MSSQL()
whetstone.Users(sql).transform_and_load()
whetstone.Schools(sql).transform_and_load()
whetstone.Meetings(sql).transform_and_load()
whetstone.Observations(sql).transform_and_load()
whetstone.Measurements(sql).transform_and_load()
whetstone.Assignments(sql).transform_and_load()
whetstone.Informals(sql).transform_and_load()
whetstone.Rubrics(sql).transform_and_load()
tags = [
"courses",
"tags",
"grades",
"measurement_groups",
"goal_types",
"meeting_types",
"observation_types",
"assignment_types",
"assignment_presets",
"user_types",
"measurement_types",
"meeting_modules",
"meeting_standards",
"observation_labels",
"observation_modules",
"observation_types",
"periods",
"tracks",
"plu_content_areas",
"plu_event_types",
]
for tag in tags:
whetstone.Tag(sql, tag).transform_and_load()
if __name__ == "__main__":
try:
main()
error_message = None
except Exception as e:
logging.exception(e)
error_message = traceback.format_exc()
if int(os.getenv("ENABLE_MAILER", default=0)):
Mailer("Whetstone Connector").notify(error_message=error_message)