Commit 13d65379 authored by Renzo Marini's avatar Renzo Marini

obras cambios minimos

parent f8bc6785
......@@ -47,10 +47,10 @@ def download_anp(tmp_path):
os.makedirs(destination_folder)
# Loguearse
# options = Options()
# options.headless = True
# driver = webdriver.Firefox(options=options)
driver = webdriver.PhantomJS()
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
#driver = webdriver.PhantomJS()
driver.get("http://mareografo.anp.com.uy/")
wait = WebDriverWait(driver, 15)
driver.implicitly_wait(20)
......
......@@ -47,8 +47,7 @@ def get_downloader_args(f, terminal_args):
def start_logging(source):
global log_handle
log_path = metadata.logs_path + "/" + source + ".log"
log_handle = open(log_path, "w")
fcntl.flock(log_handle, fcntl.LOCK_EX)
log_handle = open(log_path, "a+")
sys.stderr = log_handle
sys.stdout = log_handle
......@@ -63,7 +62,7 @@ def disable_same_calls(args):
lock_name = "".join([str(args[arg]) for arg in args])
lock_name = lock_name.replace("/", "").replace(" ", "") + ".lock"
lock_path = metadata.tmp_path + "/" + lock_name
lock_handle = open(lock_path, "a")
lock_handle = open(lock_path, "w")
fcntl.flock(lock_handle, fcntl.LOCK_EX)
return lock_handle
......@@ -121,6 +120,7 @@ if __name__ == "__main__":
try:
source = args["source"]
start_logging(source)
print("testMain")
if not args["only_process"]:
downloader_path = os.path.abspath(inspect.getfile(getattr(metadata, source)["download"]))
source_config = getattr(metadata, source)
......@@ -130,7 +130,7 @@ if __name__ == "__main__":
exec.process(source, args)
except Exception as e:
log_time(source)
logging.exception(datetime.datetime.now() + "\n" + repr(e))
logging.exception(str(datetime.datetime.now()) + "\n" + repr(e))
stop_logging(source)
finally:
enable_same_calls(lock_handle)
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