Skip to content
Snippets Groups Projects
Commit ca6ab66e authored by Mattia Mancini's avatar Mattia Mancini
Browse files

SW-720: refactoring logging lines

parent 20974630
No related branches found
No related tags found
1 merge request!6Import cobalt2 into lofar4
......@@ -127,7 +127,7 @@ def _parse_activity_paths(spec):
paths[activikey] = path
for key in list(paths.keys()):
logger.debug("Activity path -> " + str(key) + " --> " + paths[key])
logger.debug("Activity path -> %s --> %s", key, paths[key])
return paths
......@@ -142,8 +142,8 @@ class SpecificationHandler(ServiceMessageHandler):
self.momimportxml_bus = ToBus(exchange=MOMIMPORTXML_BUSNAME, broker=DEFAULT_BROKER)
def add_specification(self, user, lofar_xml):
logger.info("got specification from user " + str(user))
logger.debug("LOFAR-XML: " + lofar_xml)
logger.info("got specification from user %s", user)
logger.debug("LOFAR-XML: %s", lofar_xml)
self._validate_lofarspec(lofar_xml)
logger.info("lofar xml validates!")
......@@ -159,7 +159,7 @@ class SpecificationHandler(ServiceMessageHandler):
logger.info("Fired and forgot to mom.importXML")
def get_specification(self, user, id):
logger.info("getting spec of id " + str(id))
logger.info("getting spec of id %s", id)
with self.momqueryrpc:
response = self.momqueryrpc.get_trigger_spec(user, id)
return response
......@@ -200,7 +200,7 @@ class SpecificationHandler(ServiceMessageHandler):
if activity.find(action) is not None:
jobtype = action
break
logger.warning("!!! %s not found..." % (action,))
logger.warning("!!! %s not found...", action)
if jobtype is None:
raise Exception("Specified activity is not permitted: " + str(key) + " -> " + str(
permitted_activities)
......@@ -220,20 +220,20 @@ class SpecificationHandler(ServiceMessageHandler):
self._authenticateAction(str(user), str(project), str(jobtype), str(status.text))
def _isActive(self, project):
logger.debug("Checking if project is active: " + project)
logger.debug("Checking if project is active: %s", project)
with self.momqueryrpc:
response = self.momqueryrpc.isProjectActive(project) # todo mock this for testing
return response['active']
def _folderExists(self, path):
logger.debug("Checking if path exists -> " + path)
logger.debug("Checking if path exists -> %s", path)
with self.momqueryrpc:
response = self.momqueryrpc.folderExists(path) # todo mock this for testing
return response["exists"]
def _authenticateAction(self, user, project, jobtype, state):
logger.debug(
"Authenticate action -> " + user + ', ' + project + ', ' + jobtype + ', ' + state)
"Authenticate action -> %s, %s, %s, %s", user, project, jobtype, state)
with self.momqueryrpc:
response = self.momqueryrpc.authorized_add_with_status(user, project, jobtype,
state) # todo mock this for testing
......@@ -243,13 +243,13 @@ class SpecificationHandler(ServiceMessageHandler):
with self.validationrpc:
response = self.validationrpc.validate_specification(lofar_xml)
if not response["valid"]:
raise Exception("Invalid specification: " + response["error"])
raise Exception("Invalid specification: %s", response["error"])
def _validate_momspec(self, mom_xml):
with self.validationrpc:
response = self.validationrpc.validate_mom_specification(mom_xml)
if not response["valid"]:
raise Exception("Invalid MoM specification: " + response["error"])
raise Exception("Invalid MoM specification: %s", response["error"])
def _add_spec_to_mom(self, mom_xml):
# Construct message payload using old-style (MessageBus) message format
......@@ -266,7 +266,7 @@ class SpecificationHandler(ServiceMessageHandler):
with self.momimportxml_bus:
self.momimportxml_bus.send(emsg)
logger.debug("Send specs to MOM: " + mom_xml)
logger.debug("Send specs to MOM: %s", mom_xml)
def _lofarxml_to_momxml(self, lofarxml):
logger.debug("Translating LOFAR spec to MoM spec")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment