From d397ce377e57b10b471db51cbcb988fc8cb86949 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 20 Dec 2022 10:23:25 +0100 Subject: [PATCH] [update] add network/station blacklists for mail functionality --- parameters.yaml | 2 ++ submit_bot.sh | 2 +- survBot.py | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/parameters.yaml b/parameters.yaml index 37e5c42..0fdf7c6 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -58,6 +58,8 @@ EMAIL: mailserver: "localhost" addresses: ["marcel.paffrath@rub.de", "kasper.fischer@rub.de"] # list of mail addresses for info mails sender: "webmaster@geophysik.ruhr-uni-bochum.de" # mail sender + stations_blacklist: ['GR33'] # do not send emails for specific stations + networks_blacklist: [] # do not send emails for specific network # names for plotting of the above defined parameter "channels" in the same order channel_names: ["Temperature (°C)", "230V/12V Status (V)", "Router/Charger State (V)", "Logger Voltage (V)"] diff --git a/submit_bot.sh b/submit_bot.sh index 7e5fe28..7b1f724 100755 --- a/submit_bot.sh +++ b/submit_bot.sh @@ -6,7 +6,7 @@ ulimit -s 8192 #$ -cwd #$ -pe smp 1 #$ -N survBot_bg -##$ -l os=*stretch +#$ -l os=*stretch source /opt/anaconda3/etc/profile.d/conda.sh conda activate py37 diff --git a/survBot.py b/survBot.py index ce1f057..10dfabf 100755 --- a/survBot.py +++ b/survBot.py @@ -581,11 +581,25 @@ class StationQC(object): if self.verbosity: print('Mail functionality disabled. Return') return + mail_params = self.parameters.get('EMAIL') if not mail_params: if self.verbosity: print('parameter "EMAIL" not set in parameter file. Return') return + + stations_blacklist = mail_params.get('stations_blacklist') + if stations_blacklist and self.station in stations_blacklist: + if self.verbosity: + print(f'Station {self.station} listed in blacklist. Return') + return + + networks_blacklist = mail_params.get('networks_blacklist') + if networks_blacklist and self.network in networks_blacklist: + if self.verbosity: + print(f'Station {self.station} of network {self.network} listed in blacklist. Return') + return + sender = mail_params.get('sender') addresses = mail_params.get('addresses') server = mail_params.get('mailserver')