From df4af8751a5c1e1465159083100b82e58e7778f7 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Mon, 5 Aug 2024 14:44:44 +0800 Subject: Update write_log_file() so that it put the most recent message on the top; remove duplicate write_log_file() --- Code/update_network.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'Code/update_network.py') diff --git a/Code/update_network.py b/Code/update_network.py index e8d5a1d..d5aed9b 100755 --- a/Code/update_network.py +++ b/Code/update_network.py @@ -47,6 +47,7 @@ import time import subprocess from datetime import datetime from param4net import make_global_param_dict, get_key_value +from log import write_log_file from configure import HISTORY_DIR, HISTORY_DIR2, FILE_TIMESTAMP, SAMPLE_SIZE_FILE, TEMP_DIR, \ PARAMETER_FOR_BUILDCMATRIX, PARAMETER_FOR_BUILDRMATRIX, \ PARAMETER_FOR_NET, PARAMETER_FOR_NET_TRAVADB_STRESS, PARAMETER_FOR_NET_TRAVADB_MAP, PARAMETER_FOR_NET_MILD_DROUGHT, PARAMETER_FOR_NET_WIGGELAB_DIURNAL, \ @@ -123,17 +124,6 @@ def num_ids(fname): return len(lines[0].split('\t')) - 1 -def write_log_file(s, fname): - f = open(fname, 'a') - curr_time = datetime.now().strftime('%Y-%m-%d %H:%M') - s = '[' + curr_time + ']: ' + s - if not '\n' in s: - s += '\n' - f.write(s) - f.close() - print('Log: %s' % (s.strip())) - - def write_sample_size_file(sample_size_file, curr_date, tpm_sample_size): if not os.path.exists(sample_size_file): f = open(sample_size_file, 'w') -- cgit v1.2.1