diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2021-07-20 11:15:18 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2021-07-20 11:15:18 +0800 |
commit | 9cea760a0d3e7b64eb16d99166b8b742bdc866dc (patch) | |
tree | f6cdfa81efdaa7c6a9c65629bf49ebbff9aaec9f /Code/update_network_by_force.py | |
parent | 210006b0026ad76ba1d881ff4f5b79f0bdb8e859 (diff) |
update_network_by_force.py: get the difference in edges (yesterday vs. today).
Diffstat (limited to 'Code/update_network_by_force.py')
-rw-r--r-- | Code/update_network_by_force.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Code/update_network_by_force.py b/Code/update_network_by_force.py index c47002c..4d72463 100644 --- a/Code/update_network_by_force.py +++ b/Code/update_network_by_force.py @@ -10,8 +10,10 @@ import time from datetime import datetime from configure import HISTORY_DIR, HISTORY_DIR2, UPDATE_NETWORK_LOG_FILE, MERGED_EDGE_FILE, EDGE_POOL_DIR from configure import PARAMETER_FOR_BUILDCMATRIX, PARAMETER_FOR_BUILDRMATRIX, PARAMETER_FOR_NET +from configure import DIFF_EDGE_FILE from backup_files import copy_and_backup_file from overlap import Overlap +import utils ########## Helper functions ####################### def write_log_file(s, fname): @@ -134,12 +136,15 @@ if os.path.getmtime(MERGED_EDGE_FILE) < os.path.getmtime(EDGE_POOL_DIR): # edge write_log_file('[update_network_by_force.py] Make a new edges.txt from edge files in %s.' % (EDGE_POOL_DIR), UPDATE_NETWORK_LOG_FILE) write_log_file('[update_network_by_force.py] Number of lines in the old edges.txt: %d.' % (num_line(MERGED_EDGE_FILE)), UPDATE_NETWORK_LOG_FILE) write_log_file('[update_network_by_force.py] %s' % (summarize_edge_file(MERGED_EDGE_FILE)), UPDATE_NETWORK_LOG_FILE) + Sold = utils.get_edge_set(MERGED_EDGE_FILE) # all old edges stored in a set cmd = 'python3 merge_edges.py' # invoke another script the merge all edge files in EDGE_POOL_DIR return_value = os.system(cmd) if return_value != 0: write_log_file('[update_network_by_force.py] Something wrong occurred to merge_edges.py. Perhaps your computer is running out of memory.', UPDATE_NETWORK_LOG_FILE) write_log_file('[update_network_by_force.py] Number of lines in the new edges.txt: %d.' % (num_line(MERGED_EDGE_FILE)), UPDATE_NETWORK_LOG_FILE) - write_log_file('[update_network_by_force.py] %s' % (summarize_edge_file(MERGED_EDGE_FILE)), UPDATE_NETWORK_LOG_FILE) + write_log_file('[update_network_by_force.py] %s' % (summarize_edge_file(MERGED_EDGE_FILE)), UPDATE_NETWORK_LOG_FILE) + Snew = utils.get_edge_set(MERGED_EDGE_FILE) # all new edges stored in a set. Note that MERGED_EDGE_FILE has been updated by 'python3 merge_edges.py' + utils.make_new_edges_file(Sold, Snew, MERGED_EDGE_FILE, DIFF_EDGE_FILE) manual_copy_commands = 'Please copy files to the web application: sudo cp /home/lanhui/brain/Data/temp/edges.txt /var/www/brain/brain/static/edges/edges.txt sudo cp /home/lanhui/brain/Data/temp/html_edges/edges.sqlite /var/www/brain/brain/static/edges curl http://118.25.96.118/brain/before' write_log_file('[update_network_by_force.py] %s' % (manual_copy_commands), UPDATE_NETWORK_LOG_FILE) write_log_file('[update_network_by_force.py] Make html files for the web application.', UPDATE_NETWORK_LOG_FILE) |