diff options
author | Hui Lan <lanhui@zjnu.edu.cn> | 2020-01-21 12:17:49 +0800 |
---|---|---|
committer | Hui Lan <lanhui@zjnu.edu.cn> | 2020-01-21 12:17:49 +0800 |
commit | a93b28f0e147ae51c06254132c22e7460ad3d70a (patch) | |
tree | e8d97fdf4b147d34d0a2ee074b70721c6ca1a92e /Code | |
parent | 6701b310b0f2694b681517381ad889ec67012fe0 (diff) |
update_network_by_force.py: update G.pickle and SOURCE_NODES.pickle with edges.txt
Visit the following link to update two pickle files used the Webapp, G.pickle and SOURCE_NODES.pickle.
http://118.25.96.118/brain/before
The visit could be done using the command line tool curl, as follows:
curl http://118.25.96.118/brain/before
-Hui
Diffstat (limited to 'Code')
-rw-r--r-- | Code/update_network_by_force.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Code/update_network_by_force.py b/Code/update_network_by_force.py index eb33b82..d6631c5 100644 --- a/Code/update_network_by_force.py +++ b/Code/update_network_by_force.py @@ -100,6 +100,10 @@ def summarize_edge_file(fname): return 'Total edges is 0.' +########## Renew saved G.pickle and SOURCE_NODES.pickle in Webapp ####################### +cmd = 'curl http://118.25.96.118/brain/before' +os.system(cmd) + ########## Merge edges ####################### # update edges.txt, a merged file from two sources, HISTORY_DIR and HISTORY_DIR2. Some new edge files are being generated ... time.sleep(3) @@ -135,7 +139,7 @@ if os.path.getmtime(MERGED_EDGE_FILE) < os.path.getmtime(EDGE_POOL_DIR): # edge os.system(cmd) 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) - 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' + 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) copy_and_backup_file(MERGED_EDGE_FILE, '../Analysis') # the backup file will be used for further analysis |