diff options
| author | jwansek <eddie.atten.ea29@gmail.com> | 2025-11-04 14:05:46 +0000 |
|---|---|---|
| committer | jwansek <eddie.atten.ea29@gmail.com> | 2025-11-04 14:05:46 +0000 |
| commit | af86a9a01c36002d18b9666f470d7a3fce0e533c (patch) | |
| tree | 097ca03e07b9845a360d5c02ce13b6a7c083cf46 | |
| parent | db922ff88310724334495f21db2fa6fe3c16e791 (diff) | |
| download | SmallYTChannelBot-af86a9a01c36002d18b9666f470d7a3fce0e533c.tar.gz SmallYTChannelBot-af86a9a01c36002d18b9666f470d7a3fce0e533c.zip | |
Updated logging on hourly cronjob
| -rw-r--r-- | cron/hourly.py | 7 | ||||
| -rwxr-xr-x | cron/requirements.txt | 2 | ||||
| -rwxr-xr-x | subreddit.py | 3 |
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) |
