Commit 319259bd authored by renzo's avatar renzo

testing

parent 13d65379
......@@ -69,6 +69,7 @@ def disable_same_calls(args):
def enable_same_calls(handle):
fcntl.flock(handle, fcntl.LOCK_UN)
handle.close()
def log_time(source):
......@@ -93,7 +94,7 @@ def clean_log(source):
error_stamps = dict(pickle.load(handle_state))
if source in error_stamps:
day_diff = (datetime.date.today() - error_stamps[source]).days
if day_diff > metadata.logs_expiration:
if day_diff >= metadata.logs_expiration:
f = open(metadata.logs_path + "/" + source + ".log", 'r+')
f.truncate(0)
fcntl.flock(handle_state, fcntl.LOCK_UN)
......@@ -114,13 +115,12 @@ if __name__ == "__main__":
parser.add_argument(final_arg, type=metadata.args[arg]["type"], help=metadata.args[arg]["help"])
args = vars(parser.parse_args())
lock_handle = disable_same_calls(args)
# Try to execute downloading and processing scripts
try:
lock_handle = disable_same_calls(args)
source = args["source"]
start_logging(source)
print("testMain")
print("testMain", flush=True)
if not args["only_process"]:
downloader_path = os.path.abspath(inspect.getfile(getattr(metadata, source)["download"]))
source_config = getattr(metadata, source)
......
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