Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 2a001288 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update controller harvest/run to use logger.

parent fa08a5b3
......@@ -2,6 +2,7 @@
"""
import json
import logging
import traceback
from gluon import current
......@@ -354,6 +355,8 @@ def run():
Search arguments are defined via the harvester selector.
"""
logger.debug(f"run harvester {request.vars.Harvester_selectorController}")
if db(db.affiliation_keys.id > 0).count() == 0:
return inline_alert(T("Error"), T(MSG_NO_AFFILIATION))
......@@ -393,14 +396,23 @@ def run():
log = tool.logs[-1]
msg = "<h4>Error on record %s (%s)</h4>" % (log.url, log.collection)
msg += T(str(e))
logger.error(f"{msg.strip('<h4>')}")
return msg
except Exception as e:
logger.error(f"{str(e)}")
msg = "<hr/>"
msg += CODE(traceback.format_exc()).xml()
msg += "<hr/>"
return msg
if logger.getEffectiveLevel() == logging.DEBUG:
logger.debug("")
logger.debug(f"end of run harvester {selector.controller}:")
for el in collection_logs:
logger.debug(f" {el.title}: {el.found}")
# delegate rendering to the report view
response.view = "harvest/layout.%s" % request.extension
return dict(collection_logs=collection_logs,
......
......@@ -16,8 +16,10 @@ Note:
They can be retrieved in module via the protocol "current".
"""
from _mydb import DBURIS
import logging
from _mydb import DBURIS
from authentication import configure_auth, USER
from gluon import current
from gluon.tools import PluginManager
......@@ -39,6 +41,13 @@ from ui.report import ReportUI
from ui.selector import SelectorUI
from ui.viewport import ViewportUi
# ............................................................................
#
# logger to be used in controllers and views
#
logger = logging.getLogger("web2py.app.limbra")
# ............................................................................
#
# Connection to databases
......
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