aboutsummaryrefslogtreecommitdiffstats
path: root/python/globeop.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/globeop.py')
-rw-r--r--python/globeop.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/python/globeop.py b/python/globeop.py
new file mode 100644
index 00000000..80515b83
--- /dev/null
+++ b/python/globeop.py
@@ -0,0 +1,26 @@
+import logging
+import argparse
+import pandas as pd
+from task_server.globeop import download_data, upload_data
+
+logging.basicConfig(filename='/home/share/CorpCDOs/logs/globeop.log',
+ level=logging.INFO,
+ format='%(asctime)s %(message)s')
+
+parser = argparse.ArgumentParser()
+group = parser.add_mutually_exclusive_group(required=True)
+## options are technically not exclusive, but we will be running them
+## at different times of the day
+group.add_argument("-d", "--download", action="store_true",
+ help="download reports from GlobeOp")
+group.add_argument("-u", "--upload", action="store_true",
+ help="upload marks to GlobeOp")
+parser.add_argument("date", nargs='?', type=lambda s: pd.datetime.strptime(s, "%Y-%m-%d"),
+ default=pd.datetime.today())
+args = parser.parse_args()
+
+if args.download:
+ download_data(args.date)
+elif args.upload:
+ engine = create_engine('postgresql://dawn_user@debian/dawndb')
+ upload_data(args.date)