aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cron/hourly.py7
-rwxr-xr-xcron/requirements.txt2
-rwxr-xr-xsubreddit.py3
3 files changed, 10 insertions, 2 deletions
diff --git a/cron/hourly.py b/cron/hourly.py
index daf46ec..89a6027 100644
--- a/cron/hourly.py
+++ b/cron/hourly.py
@@ -3,12 +3,14 @@ import sys
sys.path.insert(1, os.path.join(os.path.dirname(__file__), ".."))
+from matplotlib.ticker import EngFormatter
from discord_webhook import DiscordWebhook
from operator import itemgetter
import subprocess
import subreddit
import database
import datetime
+import time
def dump():
subprocess.run(["rm", "-fv", "/tmp/*.sql*"])
@@ -38,6 +40,11 @@ def push(fp = "/tmp/sytc_nolog.sql.gz"):
subreddit.display(str(response))
if __name__ == "__main__":
+ fmt = EngFormatter("B")
+ starttime = time.time()
dump()
+ subreddit.display("\n\nDumped %s in %.1fs\n" % (fmt(os.path.getsize("/tmp/sytc_nolog.sql.gz")), time.time() - starttime))
+ starttime = time.time()
push()
+ subreddit.display("Pushed to discord in %.2fs\n" % (time.time() - starttime))
diff --git a/cron/requirements.txt b/cron/requirements.txt
index f2c4fc9..86f552b 100755
--- a/cron/requirements.txt
+++ b/cron/requirements.txt
@@ -1,3 +1,3 @@
numpy==1.26.4
-# matplotlib
+matplotlib
discord-webhook
diff --git a/subreddit.py b/subreddit.py
index 5f12e74..0360dea 100755
--- a/subreddit.py
+++ b/subreddit.py
@@ -49,7 +49,8 @@ logging.basicConfig(
# logger.addHandler(handler)
def get_time():
- return time.strftime("%b %d %Y %H:%M:%S", time.gmtime())
+ # return time.strftime("%b %d %Y %H:%M:%S", time.gmtime())
+ return datetime.datetime.now().astimezone().isoformat()
def display(message, concerning = None):
logging.info(message)