Logging en explorer.py

This commit is contained in:
pablo 2020-03-26 11:47:12 +01:00
parent acfeeef0d1
commit c8ea77e99a

View file

@ -36,12 +36,13 @@ class Explorer:
self.queue_retries = 0 self.queue_retries = 0
def start(self): def start(self):
logging.info("Starting explorer")
while True: while True:
if not self.there_is_work(): if not self.there_is_work():
print("{}: Waiting. No work".format(datetime.datetime.now())) print("{}: Waiting. No work".format(datetime.datetime.now()))
sleep(Explorer.sleep_time_no_work) sleep(Explorer.sleep_time_no_work)
continue continue
logging.info("Waiting")
if not self.database_is_up(): if not self.database_is_up():
alert_master( alert_master(
@ -52,7 +53,7 @@ class Explorer:
current_task = ExploringTask(self.compose_listing_url()) current_task = ExploringTask(self.compose_listing_url())
current_task.explore() current_task.explore()
print("{}: Exploring done".format(datetime.datetime.now())) logging.info("Exploring task done...")
if current_task.status == "Referencias ready": if current_task.status == "Referencias ready":
referencias = current_task.get_referencias() referencias = current_task.get_referencias()
@ -61,6 +62,7 @@ class Explorer:
referencia, current_task.id referencia, current_task.id
) )
current_task._update_status("Sent to queue") current_task._update_status("Sent to queue")
logging.info("The task was successful.")
continue continue