mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
updated nightly runs with try statement in email sending
This commit is contained in:
parent
baa29ea50c
commit
4addee0fc0
@ -36,7 +36,7 @@ Usage:
|
|||||||
4) Syntax:
|
4) Syntax:
|
||||||
|
|
||||||
Our cron job has the following syntax:
|
Our cron job has the following syntax:
|
||||||
0 3 * * * BASH_ENV=~/.bashrc bash -l -c "*WHERE YOUR CVW IS MUST PUT FULL PATH*/cvw/bin/wrapper_nightly_runs.sh > *WHERE YOU WANT TO STORE LOG FILES/cron.log 2>&1"
|
0 3 * * * BASH_ENV=~/.bashrc bash -l -c "*WHERE YOUR CVW IS MUST PUT FULL PATH*/cvw/bin/wrapper_nightly-runs.sh > *WHERE YOU WANT TO STORE LOG FILES/cron.log 2>&1"
|
||||||
|
|
||||||
This cronjob sources the .bashrc file and executes the wrapper script as a user.
|
This cronjob sources the .bashrc file and executes the wrapper script as a user.
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ class FolderManager:
|
|||||||
"""
|
"""
|
||||||
Create preliminary folders if they do not exist.
|
Create preliminary folders if they do not exist.
|
||||||
These folders are:
|
These folders are:
|
||||||
nightly_runs/repos/
|
nightly-runs/repos/
|
||||||
nightly_runs/results/
|
nightly-runs/results/
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
folders (list): A list of folder names to be created.
|
folders (list): A list of folder names to be created.
|
||||||
@ -171,7 +171,7 @@ class TestRunner:
|
|||||||
The setup script will be copied from the base directory to a specific folder structure inside the base directory.
|
The setup script will be copied from the base directory to a specific folder structure inside the base directory.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
folder: the "nightly_runs/repos/"
|
folder: the "nightly-runs/repos/"
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if the script is copied successfully, False otherwise.
|
bool: True if the script is copied successfully, False otherwise.
|
||||||
@ -592,35 +592,36 @@ class TestRunner:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
for receiver_email in receiver_emails:
|
for receiver_email in receiver_emails:
|
||||||
# Compose the mutt command for each receiver email
|
# Compose the mutt command for each receiver email
|
||||||
command = [
|
command = [
|
||||||
'mutt',
|
'/usr/bin/mutt',
|
||||||
'-s', subject,
|
'-s', subject,
|
||||||
'-e', 'set content_type=text/html',
|
'-e', 'set content_type=text/html',
|
||||||
'-e', 'my_hdr From: James Stine <james.stine@okstate.edu>',
|
'-e', 'my_hdr From: James Stine <james.stine@okstate.edu>',
|
||||||
'--', receiver_email
|
'--', receiver_email
|
||||||
]
|
]
|
||||||
|
try:
|
||||||
# Open a subprocess to run the mutt command
|
# Open a subprocess to run the mutt command
|
||||||
process = subprocess.Popen(command, stdin=subprocess.PIPE)
|
process = subprocess.Popen(command, stdin=subprocess.PIPE)
|
||||||
|
# Write the email body to the subprocess
|
||||||
# Write the email body to the subprocess
|
process.communicate(body.encode('utf-8'))
|
||||||
process.communicate(body.encode('utf-8'))
|
except expression as identifier:
|
||||||
|
print(f"Error sending email: {identifier}")
|
||||||
|
except expression as identifier:
|
||||||
|
print(f"Error sending email: {identifier}")
|
||||||
#############################################
|
#############################################
|
||||||
# SETUP #
|
# SETUP #
|
||||||
#############################################
|
#############################################
|
||||||
folder_manager = FolderManager() # creates the object
|
folder_manager = FolderManager() # creates the object
|
||||||
|
|
||||||
# setting the path on where to clone new repositories of cvw
|
# setting the path on where to clone new repositories of cvw
|
||||||
path = folder_manager.create_preliminary_folders(["nightly_runs/repos/", "nightly_runs/results/"])
|
path = folder_manager.create_preliminary_folders(["nightly-runs/repos/", "nightly-runs/results/"])
|
||||||
new_folder = folder_manager.create_new_folder(["nightly_runs/repos/", "nightly_runs/results/"])
|
new_folder = folder_manager.create_new_folder(["nightly-runs/repos/", "nightly-runs/results/"])
|
||||||
|
|
||||||
# clone the cvw repo
|
# clone the cvw repo
|
||||||
folder_manager.clone_repository("nightly_runs/repos/", "https://github.com/openhwgroup/cvw.git")
|
folder_manager.clone_repository("nightly-runs/repos/", "https://github.com/openhwgroup/cvw.git")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -629,7 +630,7 @@ folder_manager.clone_repository("nightly_runs/repos/", "https://github.com/openh
|
|||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
test_runner = TestRunner() # creates the object
|
test_runner = TestRunner() # creates the object
|
||||||
test_runner.set_env_var("nightly_runs/repos/") # ensures that the new WALLY environmental variable is set correctly
|
test_runner.set_env_var("nightly-runs/repos/") # ensures that the new WALLY environmental variable is set correctly
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
@ -650,8 +651,8 @@ if test_runner.change_time_dur():
|
|||||||
|
|
||||||
# target = "wally-riscv-arch-test"
|
# target = "wally-riscv-arch-test"
|
||||||
target = "all"
|
target = "all"
|
||||||
if test_runner.execute_makefile(target = target):
|
# if test_runner.execute_makefile(target = target):
|
||||||
print(f"The {target} tests were made successfully")
|
# print(f"The {target} tests were made successfully")
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# RUN TESTS #
|
# RUN TESTS #
|
||||||
@ -724,6 +725,6 @@ test_runner.convert_to_html()
|
|||||||
sender_email = 'james.stine@okstate.edu'
|
sender_email = 'james.stine@okstate.edu'
|
||||||
# sender_email = 'thomas.kidd@okstate.edu'
|
# sender_email = 'thomas.kidd@okstate.edu'
|
||||||
|
|
||||||
receiver_emails = ['thomas.kidd@okstate.edu', 'james.stine@okstate.edu', 'harris@g.hmc.edu', 'rose.thompson10@okstate.edu', "sarah.harris@unlv.edu"]
|
# receiver_emails = ['thomas.kidd@okstate.edu', 'james.stine@okstate.edu', 'harris@g.hmc.edu', 'rose.thompson10@okstate.edu', 'sarah.harris@unlv.edu', 'nlucio@hmc.edu']
|
||||||
# receiver_emails = ['thomas.kidd@okstate.edu']
|
receiver_emails = ['thomas.kidd@okstate.edu']
|
||||||
test_runner.send_email(sender_email=sender_email, receiver_emails=receiver_emails)
|
test_runner.send_email(sender_email=sender_email, receiver_emails=receiver_emails)
|
||||||
|
@ -3,9 +3,9 @@ date
|
|||||||
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
LOG=$HOME/nightly_runs/logs/from_wrapper.log # you can store your log file where you would like
|
LOG=$HOME/nightly-runs/logs/from_wrapper.log # you can store your log file where you would like
|
||||||
PYTHON_SCRIPT=$HOME/nightly_runs/cvw/bin/ # cvw can be anywhere you would like it. Make sure to point your variable there
|
PYTHON_SCRIPT=$HOME/nightly-runs/cvw/bin/ # cvw can be anywhere you would like it. Make sure to point your variable there
|
||||||
SETUP_SCRIPT=$HOME/nightly_runs/cvw/ # cvw can be anywhere you would like it. Make sure to point your variable there
|
SETUP_SCRIPT=$HOME/nightly-runs/cvw/ # cvw can be anywhere you would like it. Make sure to point your variable there
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -25,3 +25,4 @@ cd $PYTHON_SCRIPT
|
|||||||
pwd
|
pwd
|
||||||
echo "Running python file"
|
echo "Running python file"
|
||||||
python nightly_build.py >> $LOG 2>&1
|
python nightly_build.py >> $LOG 2>&1
|
||||||
|
echo "Finished"
|
||||||
|
Loading…
Reference in New Issue
Block a user