From 76f7e0c36ee7690aea88328794afd7bacfb1ed08 Mon Sep 17 00:00:00 2001 From: neko404notfound Date: Wed, 20 Jun 2018 17:51:25 +0100 Subject: [PATCH 1/7] Requirements and traps. Requirements file was missing five requirements. This might be useful to have fixed, so I sorted that out. - opuslib - youtube_dl - asyncpg - PyNaCl - dataclasses Made the sebi_machine_launcher.sh executable only under the current owner. Added a SIGINT trap to sebi_machine_launcher.sh. You are only restarting while the bot returns a non-truthy exit code (i.e. non zero). SIGINT, which triggers the Python KeyboardInterrupt builtin exception being raised will, if unhandled, result in a non-zero exit code. Thus, if you provide a keyboard interrupt, you will just have the bot instantly respawn. This is fine until you have a one second lag over SSH. Then my wrist starts to hurt from spamming CTRL-C so many times until the bot process dies. --- requirements.txt | 11 ++++++++--- sebi_machine_launcher.sh | 13 ++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 501e963..18d6d6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,13 @@ numpy==1.14.0 aiofiles # aiomultiprocess # aiosqlite -# asyncpg -# dataclasses # cached_property uvloop==0.9.1 -aiohttp==3.2.1 \ No newline at end of file +aiohttp==3.2.1 +# Someone forgot to add this in. +asyncpg +# Music cog requirements +opuslib +dataclasses +PyNaCl +youtube_dl diff --git a/sebi_machine_launcher.sh b/sebi_machine_launcher.sh index d5140a3..423d874 100644 --- a/sebi_machine_launcher.sh +++ b/sebi_machine_launcher.sh @@ -1,6 +1,13 @@ #!/bin/bash -until python -m src; do - echo "Sebi-Machine shutdown with error: $?. Restarting..." >&2 - sleep 1 +# 20th June 2018 +# Esp: added a trap here, as it otherwise attempts to restart when given +# the interrupt signal. This is really annoying over SSH when I have +# a 1-second lag anyway. +trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT +until python -m src; do + # Added colouring to ensure the date of shutdown and the exit code stands + # out from the other clutter in the traceback that might have been output. + echo -e "\e[0;31m[$(date --utc)]\e[0m Sebi-Machine shutdown with error \e[0;31m$?\e[0m. Restarting..." >&2 + sleep 1 done From 6b9a9cc968e8b1f65b99351ffe99f736dbbe074b Mon Sep 17 00:00:00 2001 From: neko404notfound <40436815+neko404notfound@users.noreply.github.com> Date: Wed, 20 Jun 2018 18:00:16 +0100 Subject: [PATCH 2/7] Update sebi_machine_launcher.sh --- sebi_machine_launcher.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sebi_machine_launcher.sh b/sebi_machine_launcher.sh index 423d874..ff0bd21 100644 --- a/sebi_machine_launcher.sh +++ b/sebi_machine_launcher.sh @@ -5,6 +5,10 @@ # the interrupt signal. This is really annoying over SSH when I have # a 1-second lag anyway. trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT + +# Also loads the venv if it is present. +[ -d .venv/bin ] && source ./venv/bin/activate && echo "Entered venv" || echo "No venv detected." + until python -m src; do # Added colouring to ensure the date of shutdown and the exit code stands # out from the other clutter in the traceback that might have been output. From becc2d3ade5e8f9bd317dd9db562567ecff93faa Mon Sep 17 00:00:00 2001 From: neko404notfound <40436815+neko404notfound@users.noreply.github.com> Date: Wed, 20 Jun 2018 18:03:24 +0100 Subject: [PATCH 3/7] Update sebi_machine_launcher.sh --- sebi_machine_launcher.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sebi_machine_launcher.sh b/sebi_machine_launcher.sh index ff0bd21..b6d1148 100644 --- a/sebi_machine_launcher.sh +++ b/sebi_machine_launcher.sh @@ -7,7 +7,7 @@ trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT # Also loads the venv if it is present. -[ -d .venv/bin ] && source ./venv/bin/activate && echo "Entered venv" || echo "No venv detected." +[ -d .venv/bin ] && source ./venv/bin/activate && echo "Entered venv." || echo "No venv detected." until python -m src; do # Added colouring to ensure the date of shutdown and the exit code stands From a76394b568fee74377d1899fd8631e826f49fe43 Mon Sep 17 00:00:00 2001 From: davfsa Date: Wed, 20 Jun 2018 19:15:32 +0200 Subject: [PATCH 4/7] Update requirements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 18d6d6f..0b2f1e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ yarl<1.2 -numpy==1.14.0 aiofiles # aiomultiprocess # aiosqlite From 39838d3e79ccd5315e2f7e7c223e22cdfb31b998 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Wed, 20 Jun 2018 09:39:22 -0800 Subject: [PATCH 5/7] removed numpy import --- src/shared_libs/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shared_libs/utils.py b/src/shared_libs/utils.py index 9ba5998..fbd2827 100644 --- a/src/shared_libs/utils.py +++ b/src/shared_libs/utils.py @@ -32,7 +32,6 @@ import sys import asyncio import discord from discord.ext.commands.formatter import Paginator -import numpy as np class Capturing(list): From 7f2f4a32ca9d6b72ed171ccb11ce8587c94c71ee Mon Sep 17 00:00:00 2001 From: neko404notfound <40436815+neko404notfound@users.noreply.github.com> Date: Wed, 20 Jun 2018 18:39:47 +0100 Subject: [PATCH 6/7] Fixed a stupid typo. --- sebi_machine_launcher.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sebi_machine_launcher.sh b/sebi_machine_launcher.sh index b6d1148..ceb3395 100644 --- a/sebi_machine_launcher.sh +++ b/sebi_machine_launcher.sh @@ -7,7 +7,7 @@ trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT # Also loads the venv if it is present. -[ -d .venv/bin ] && source ./venv/bin/activate && echo "Entered venv." || echo "No venv detected." +[ -d .venv/bin ] && source .venv/bin/activate && echo "Entered venv." || echo "No venv detected." until python -m src; do # Added colouring to ensure the date of shutdown and the exit code stands From cd286222c11cfd4c5c3232f0dc5f9f4dd8c20aaa Mon Sep 17 00:00:00 2001 From: neko404notfound <40436815+neko404notfound@users.noreply.github.com> Date: Wed, 20 Jun 2018 18:42:48 +0100 Subject: [PATCH 7/7] Fixed broken import someone didn't check. --- src/cogs/music.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cogs/music.py b/src/cogs/music.py index 9a2f546..54eb3a9 100644 --- a/src/cogs/music.py +++ b/src/cogs/music.py @@ -11,7 +11,7 @@ from discord.ext import commands import youtube_dl # noinspection PyUnresolvedReferences,PyUnresolvedReferences,PyPackageRequirements -from utils import noblock +from . utils import noblock YT_DL_OPTS = {