Commit ebc0304d authored by Lachlan's avatar Lachlan

Add time logic to configuration file generation

parent f17eb253
......@@ -31,7 +31,7 @@ pip3 uninstall -y matplotlib
pip3 uninstall -y numpy
pip3 install matplotlib
if [ "$BRANCH" != "master" ] && [ -z "${BESPOKE_WRITE}" ] ; then
if [ "$BRANCH" != "master" ] && [ -z "${BESPOKE_WRITE}" ] && [ -z "${DEBUG_MASTER}" ]; then
python3 -m bst_benchmarks $BENCHMARK_CONF -o $DEFAULT_RESULT_PATH/$DEFAULT_FILE_NAME
if ! [ -e $DEFAULT_RESULT_PATH/$DEFAULT_FILE_NAME ]; then
exit 1
......
......@@ -32,6 +32,7 @@ import datetime
import shutil
import git
import os
import operator
# This command line executable acts as the central method for configuring
# the benchmark CI run. A number of elements are passed in to check that
......@@ -184,8 +185,11 @@ def generate_buildstream_config(output_file, results_path, run_token_path, url_p
for dirpath, dirnames, files in os.walk(results_path):
if files:
list_of_files = glob.glob(results_path + '*.json')
if list_of_files:
latest_file = max(list_of_files, key=os.path.getmtime)
file_times = {}
for file in list_of_files:
file_times[file] = datetime.datetime.strptime(os.path.basename(file), 'results-%Y-%m-%d-%H:%M:%S.json')
if file_times:
latest_file = max(file_times.items(), key=operator.itemgetter(1))[0]
archive_result = ntpath.basename(latest_file)
else:
logging.info('No results files found from: ', results_path)
......
......@@ -15,8 +15,9 @@ else
fi
BENCHMARK_CONF="$BENCHMARK_CONF -c bs_catchup.benchmark"
./ci_run.sh "$BENCHMARK_CONF"
if [ -z "${BESPOKE_CONFIG}" ] || ! [ -z "${DEBUG_MASTER}" ]; then
if [ -z "${BESPOKE_CONFIG}" ] || ! [ -z "${DEBUG_MASTER}" ] || ! [ -z "${FOLLOW_BUILDSTREAM}" ]; then
if [ ! -f 'pipeline_cache/run_token.yml' ]; then
echo "Copying run token to pipeline cache for update"
cp 'results_cache/run_token.yml' 'pipeline_cache/'
fi
python3 update_run_token.py -t 'pipeline_cache/run_token.yml' -i 'pipeline_cache/'
......
......@@ -67,7 +67,7 @@ def main():
print(results_files)
if not update_run_token(token_file=token_file, results_files=results_files):
logging.error('Unable to update token file: ', token_file)
logging.error('Unable to update token file: %s', token_file)
os.sys.exit(1)
def update_run_token(token_file, results_files):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment