summaryrefslogtreecommitdiff
path: root/Code/update_network.py
diff options
context:
space:
mode:
Diffstat (limited to 'Code/update_network.py')
-rwxr-xr-xCode/update_network.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Code/update_network.py b/Code/update_network.py
index 82c8cb9..376b948 100755
--- a/Code/update_network.py
+++ b/Code/update_network.py
@@ -41,7 +41,6 @@
# Last modified: 10 Sep 2019, hui <lanhui@zjnu.edu.cn> [correlation_mixtools, check the previous R session has finished before starting a new one.]
import os, sys
-import numpy as np
import glob
import time
from datetime import datetime
@@ -130,6 +129,11 @@ def write_sample_size_file(sample_size_file, curr_date, tpm_sample_size):
f.close()
+def empty_file(fname):
+ with open(fname) as f:
+ return f.read().strip() == ''
+
+
def age_of_file_in_days(fname):
''' Return age of fname in days. '''
st = os.stat(fname)
@@ -604,7 +608,7 @@ validate_parameter_for_net(PARAMETER_FOR_NET)
# If the file timestamp does not exist, create one
-if not os.path.exists(TIMESTAMP_FILE):
+if not os.path.exists(TIMESTAMP_FILE) or empty_file(TIMESTAMP_FILE):
record_file_time(FILE_LIST_TO_CHECK, TIMESTAMP_FILE)
# Get update time of mandatory files