Skip to content

Commit

Permalink
notifier: drop SMTP support
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVanAssche committed Jan 4, 2024
1 parent 5c83393 commit a3c9f8a
Show file tree
Hide file tree
Showing 7 changed files with 360 additions and 507 deletions.
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ You can list all options and arguments with `--help`

```
usage: exectool [-h] [--version] [--root MAIN_DIRECTORY] [--runs NUMBER_OF_RUNS] [--interval INTERVAL] [--verbose] [--wait-for-user]
[--smtp-server SMTP_SERVER] [--smtp-port SMTP_PORT] [--smtp-username SMTP_USERNAME] [--smtp-password SMTP_PASSWORD]
[--smtp-sender SMTP_SENDER] [--smtp-receiver SMTP_RECEIVER]
command
Copyright by (c) Dylan Van Assche (2022-2024), available under the MIT license
Expand All @@ -28,18 +26,6 @@ options:
--interval INTERVAL Measurement sample interval for metrics, default 0.1s
--verbose Turn on verbose output
--wait-for-user Show a prompt when a step is executed before going to the next one
--smtp-server SMTP_SERVER
SMTP server to use for sending e-mails
--smtp-port SMTP_PORT
SMTP port to use for sending e-mails
--smtp-username SMTP_USERNAME
Username to authenticate with SMTP server for sending e-mails
--smtp-password SMTP_PASSWORD
Password to authenticate with SMTP server for sending e-mails
--smtp-sender SMTP_SENDER
Sender's e-mailaddress for sending e-mails
--smtp-receiver SMTP_RECEIVER
Receiver's e-mailaddress for sending emails
```

### Generating cases
Expand Down
3 changes: 1 addition & 2 deletions bench_executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
import bench_executor.collector
import bench_executor.stats
import bench_executor.executor
import bench_executor.container
import bench_executor.notifier # noqa: F401
import bench_executor.container # noqa: F401
20 changes: 11 additions & 9 deletions bench_executor/data/collector/results/run_1/case-info.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
===> CASE <===
Name: my-case-name
Timestamp: 2023-08-01T08:46:51.536158
Directory: /home/dylan/Projects/metrics-execution-tool/tests/./../bench_executor/log
Timestamp: 2024-01-04T13:42:20.456726+00:00
Directory: /home/dylan/PhD/RML-LDES Journal/data/metrics-executor-tool/tests/./../bench_executor/log
Run: 1
Number of steps: 4

===> HARDWARE <===
System
Hostname: dell-laptop
OS name: Fedora Linux
OS version: 38 (Workstation Edition)
Kernel: Linux-6.4.4-200.fc38.x86_64-x86_64-with-glibc2.37
OS version: 39 (Workstation Edition)
Kernel: Linux-6.6.8-200.fc39.x86_64-x86_64-with-glibc2.38
Architecture: x86_64
CPU
Name: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Cores: 8
Minimum frequency: 400 Hz
Maximum frequency: 4200 Hz
Memory
RAM memory: 16605 MB
RAM memory: 16617 MB
SWAP memory: 8589 MB
Storage
Disk "/": 510.48 GB
Expand All @@ -27,13 +27,15 @@ Storage
Disk "/boot/efi": 0.54 GB
Network
Interface "lo"
Interface "enp0s31f6": 1000 mbps
Interface "enp0s31f6"
Interface "wlp2s0"
Interface "docker0"
Interface "br-fc27d82a1e7f"
Interface "docker0": 10000 mbps
Interface "tun0": 10000 mbps
Interface "br-8b7c5071df4c"
Interface "vethe982ad6": 10000 mbps

===> DOCKER <===
Version: 20.10.23
Version: 24.0.7
Root directory: /var/lib/docker
Drivers:
Storage: btrfs
Expand Down
688 changes: 344 additions & 344 deletions bench_executor/data/collector/results/run_1/metrics.csv

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bench_executor/data/ontopvirtualize/config.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jdbc.url=jdbc:postgresql://PostgreSQL:5432/db
jdbc.driver=org.postgresql.Driver
jdbc.url=jdbc:mysql://MySQL:3306/db
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.user=root
jdbc.password=root

81 changes: 0 additions & 81 deletions bench_executor/notifier.py

This file was deleted.

57 changes: 2 additions & 55 deletions exectool
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ from datetime import datetime
from signal import signal, SIGINT
from zipfile import ZipFile
from bench_executor.executor import Executor
from bench_executor.notifier import Notifier

VERSION = '0.2.0'
EXIT_CODE_SUCCESS = 0
Expand Down Expand Up @@ -101,8 +100,7 @@ def print_cases(executor: Executor):
print(f'{index+1: >4}. {name: <85} {number_of_steps: >11}')


def execute_cases(executor: Executor, interval: float, runs: int,
notifier: Notifier):
def execute_cases(executor: Executor, interval: float, runs: int):
"""Execute all cases.
Parameters
Expand All @@ -113,9 +111,6 @@ def execute_cases(executor: Executor, interval: float, runs: int,
Sample interval for collecting metrics.
runs : int
Number of runs for each case.
notifier : Notifier
An instance of the Notifier class to notify the user about the
execution.
"""
global stop
failures = []
Expand All @@ -129,9 +124,6 @@ def execute_cases(executor: Executor, interval: float, runs: int,
sys.exit(EXIT_CODE_NO_CASES)

print(f'Executing {len(cases)} cases:')
notifier.send('Execution STARTED',
f'Executing {len(cases)} cases'
f'\nRoot: "{executor.main_directory}"')
start_time = datetime.now()
for index, case in enumerate(cases):
success = True
Expand Down Expand Up @@ -174,16 +166,9 @@ def execute_cases(executor: Executor, interval: float, runs: int,
except Exception as exception:
print(f'Case failure due to exception: {exception}',
file=sys.stderr)
notifier.send('Execution FAILED',
'Execution failed due to exception\n'
f'Root: {executor.main_directory}\n'
f'Exception: {exception})')
sys.exit(EXIT_CODE_FAILED_CASE)

if stop:
notifier.send('Execution INTERRUPTED',
'Execution was interrupted by the user\n'
f'Root: {executor.main_directory}')
sys.exit(EXIT_CODE_INTERRUPTED)

if not success:
Expand All @@ -202,15 +187,13 @@ def execute_cases(executor: Executor, interval: float, runs: int,
msg += f'{index+1: >4}. {f: <76}\n'
print(msg)
msg += f'\nRoot: "{executor.main_directory}"'
notifier.send('Execution FAILED', msg)
sys.exit(EXIT_CODE_FAILED_CASE)
else:
text = f'{len(cases)} cases executed succesfully'
progress = _format_progress(len(cases), len(cases), start_time)
msg = f'{text: <89} {progress: <13}'
print(msg)
msg = f'{text: <89}\nRoot: "{executor.main_directory}"'
notifier.send('Execution FINISHED', msg)


def clean_cases(executor: Executor):
Expand Down Expand Up @@ -391,26 +374,6 @@ if __name__ == '__main__':
parser.add_argument('--wait-for-user', dest='wait_for_user',
help='Show a prompt when a step is executed before '
'going to the next one', action='store_true')
parser.add_argument('--smtp-server', dest='smtp_server', default=None,
help='SMTP server to use for sending e-mails',
type=str)
parser.add_argument('--smtp-port', dest='smtp_port', default=None,
help='SMTP port to use for sending e-mails',
type=int)
parser.add_argument('--smtp-username', dest='smtp_username', default=None,
help='Username to authenticate with SMTP server '
'for sending e-mails',
type=str)
parser.add_argument('--smtp-password', dest='smtp_password', default=None,
help='Password to authenticate with SMTP server '
'for sending e-mails',
type=str)
parser.add_argument('--smtp-sender', dest='smtp_sender', default=None,
help='Sender\'s e-mailaddress for sending e-mails',
type=str)
parser.add_argument('--smtp-receiver', dest='smtp_receiver', default=None,
help='Receiver\'s e-mailaddress for sending emails',
type=str)
args = parser.parse_args()

# Resolve path
Expand All @@ -421,11 +384,6 @@ if __name__ == '__main__':
download_challenge()
sys.exit(EXIT_CODE_SUCCESS)

notifications = False
if args.smtp_server and args.smtp_port and args.smtp_username \
and args.smtp_password and args.smtp_sender and args.smtp_receiver:
notifications = True

if args.verbose:
print(f'{parser.prog} {VERSION}')
print(f'Command: {args.command}')
Expand All @@ -434,13 +392,6 @@ if __name__ == '__main__':
print(f'Number of runs: {args.number_of_runs}')
print(f'Measurement sample interval: {args.interval}s')
print(f'Wait for user after case: {args.wait_for_user}')
if notifications:
print(f'SMTP server: {args.smtp_server}')
print(f'SMTP port: {args.smtp_port}')
print(f'SMTP username: {args.smtp_username}')
print(f'SMTP password: {args.smtp_password}')
print(f'SMTP sender: {args.smtp_sender}')
print(f'SMTP receiver: {args.smtp_receiver}')

if args.interval % 2 == 0:
print('Number of runs must be uneven for generating statistics',
Expand All @@ -463,16 +414,12 @@ if __name__ == '__main__':
except FileNotFoundError:
pass

notifier = Notifier(args.smtp_server, args.smtp_port,
args.smtp_username, args.smtp_password,
args.smtp_sender, args.smtp_receiver, main_directory,
args.verbose)
e = Executor(main_directory, verbose=args.verbose, progress_cb=progress_cb)

if args.command == 'list':
print_cases(e)
elif args.command == 'run':
execute_cases(e, args.interval, args.number_of_runs, notifier)
execute_cases(e, args.interval, args.number_of_runs)
elif args.command == 'clean':
clean_cases(e)
elif args.command == 'stats':
Expand Down

0 comments on commit a3c9f8a

Please sign in to comment.