Commit 1626dc32 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

make logging in debug mode less verbose

parent 8fa1e0ec
...@@ -122,11 +122,11 @@ def main(argv): ...@@ -122,11 +122,11 @@ def main(argv):
rs = cur.fetchall() rs = cur.fetchall()
for (testid, starttime) in rs: for (testid, starttime) in rs:
testid = str(testid) testid = str(testid)
logger.debug("Found test ID %s to delete." % testid) logger.info("Found test ID %s to delete." % testid)
# If a test is to be deleted which has not run yet, delete it completely. Otherwise, keep the metadata of the test for statistics: # If a test is to be deleted which has not run yet, delete it completely. Otherwise, keep the metadata of the test for statistics:
if (starttime > datetime.datetime.today()): if (starttime > datetime.datetime.today()):
delete_all = True delete_all = True
logger.debug("Test ID %s did not run yet, thus all data (including the test metadata) will be deleted." % testid) logger.warning("Test ID %s did not run yet, thus all data (including the test metadata) will be deleted." % testid)
else: else:
delete_all = False delete_all = False
# Clean through all relevant tables --- # Clean through all relevant tables ---
...@@ -140,7 +140,7 @@ def main(argv): ...@@ -140,7 +140,7 @@ def main(argv):
starttime = time.time() starttime = time.time()
num_deleted_rows = cur.execute(sql%(table, testid)) num_deleted_rows = cur.execute(sql%(table, testid))
cn.commit() cn.commit()
logger.debug("Deleted %i rows of data in table %s for test ID %s in %f seconds" % (num_deleted_rows, table, testid, (time.time()-starttime))) logger.debug("Deleted %i rows of data in table %s for test ID %s in %f seconds." % (num_deleted_rows, table, testid, (time.time()-starttime)))
# Delete cached test results --- # Delete cached test results ---
archive_path = "%s/%s%s" % (flocklab.config.get('archiver','archive_dir'), testid, flocklab.config.get('archiver','archive_ext')) archive_path = "%s/%s%s" % (flocklab.config.get('archiver','archive_dir'), testid, flocklab.config.get('archiver','archive_ext'))
...@@ -151,7 +151,7 @@ def main(argv): ...@@ -151,7 +151,7 @@ def main(argv):
os.remove(path) os.remove(path)
else: else:
shutil.rmtree(path) shutil.rmtree(path)
logger.debug("Removed path %s for test %s." % (path, testid)) logger.info("Removed path %s for test %s." % (path, testid))
# Delete test itself --- # Delete test itself ---
if delete_all: if delete_all:
...@@ -162,7 +162,7 @@ def main(argv): ...@@ -162,7 +162,7 @@ def main(argv):
starttime = time.time() starttime = time.time()
num_deleted_rows = cur.execute(sql % (testid)) num_deleted_rows = cur.execute(sql % (testid))
cn.commit() cn.commit()
logger.debug("Deleted %i rows of data in table tbl_serv_tests for test ID %s in %f seconds" % (num_deleted_rows, testid, (time.time()-starttime))) logger.debug("Deleted %i rows of data in table tbl_serv_tests for test ID %s in %f seconds." % (num_deleted_rows, testid, (time.time()-starttime)))
else: else:
# Set test status to deleted but keep metadata --- # Set test status to deleted but keep metadata ---
flocklab.set_test_status(cur, cn, int(testid), "deleted") flocklab.set_test_status(cur, cn, int(testid), "deleted")
...@@ -176,10 +176,10 @@ def main(argv): ...@@ -176,10 +176,10 @@ def main(argv):
for f in os.listdir(vizdir): for f in os.listdir(vizdir):
path = os.path.join(vizdir, f) path = os.path.join(vizdir, f)
if os.stat(path).st_mtime < earliest_keeptime: if os.stat(path).st_mtime < earliest_keeptime:
logger.debug("Removing plots %s..." % path) logger.info("Removing plots %s..." % path)
os.remove(path) os.remove(path)
else: else:
logger.debug("Directory '%s' does not exist." % vizdir) logger.warning("Directory '%s' does not exist." % vizdir)
# Get parameters --- # Get parameters ---
now = time.strftime(flocklab.config.get("database", "timeformat"), time.gmtime()) now = time.strftime(flocklab.config.get("database", "timeformat"), time.gmtime())
......
...@@ -235,11 +235,11 @@ class StartTestThread(threading.Thread): ...@@ -235,11 +235,11 @@ class StartTestThread(threading.Thread):
logger.debug("Test start script on observer ID %s succeeded (took %us)." % (self._obsdict_key[self._obskey][1], int(time.time() - starttime))) logger.debug("Test start script on observer ID %s succeeded (took %us)." % (self._obsdict_key[self._obskey][1], int(time.time() - starttime)))
# Remove image file and xml on server: # Remove image file and xml on server:
os.remove(self._xmldict_key[self._obskey][0]) os.remove(self._xmldict_key[self._obskey][0])
logger.debug("Removed XML config %s for observer ID %s" % (self._xmldict_key[self._obskey][0], self._obsdict_key[self._obskey][1])) #logger.debug("Removed XML config %s for observer ID %s" % (self._xmldict_key[self._obskey][0], self._obsdict_key[self._obskey][1]))
if self._obskey in list(self._imagedict_key.keys()): if self._obskey in list(self._imagedict_key.keys()):
for image in self._imagedict_key[self._obskey]: for image in self._imagedict_key[self._obskey]:
os.remove(image[0]) os.remove(image[0])
logger.debug("Removed target image %s for observer ID %s" % (self._imagedict_key[self._obskey][0], self._obsdict_key[self._obskey][1])) #logger.debug("Removed target image %s for observer ID %s" % (self._imagedict_key[self._obskey][0], self._obsdict_key[self._obskey][1]))
except: except:
logger.debug("Exception: %s, %s" % (str(sys.exc_info()[0]), str(sys.exc_info()[1]))) logger.debug("Exception: %s, %s" % (str(sys.exc_info()[0]), str(sys.exc_info()[1])))
...@@ -881,7 +881,7 @@ def stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort=False): ...@@ -881,7 +881,7 @@ def stop_test(testid, cur, cn, obsdict_key, obsdict_id, abort=False):
thread = StopTestThread(obskey, obsdict_key, errors_queue,testid) thread = StopTestThread(obskey, obsdict_key, errors_queue,testid)
thread_list.append((thread, obskey)) thread_list.append((thread, obskey))
thread.start() thread.start()
logger.debug("Started thread for test stop on observer ID %s" %(str(obsdict_key[obskey][1]))) #logger.debug("Started thread for test stop on observer ID %s" %(str(obsdict_key[obskey][1])))
# Wait for all threads to finish: # Wait for all threads to finish:
for (thread, obskey) in thread_list: for (thread, obskey) in thread_list:
thread.join(timeout=(flocklab.config.getint('tests','cleanuptime') * 0.75)) thread.join(timeout=(flocklab.config.getint('tests','cleanuptime') * 0.75))
......
...@@ -618,7 +618,7 @@ class FetchObsThread(threading.Thread): ...@@ -618,7 +618,7 @@ class FetchObsThread(threading.Thread):
def run(self): def run(self):
try: try:
self._loggerprefix = "(FetchObsThread.%d) "%self._obsid self._loggerprefix = "(FetchObsThread.%d) "%self._obsid
self._logger.info(self._loggerprefix + "FetchObsThread starting...") #self._logger.info(self._loggerprefix + "FetchObsThread starting...")
removelast = True removelast = True
# Let thread run until someone calls terminate() on it: # Let thread run until someone calls terminate() on it:
...@@ -700,8 +700,8 @@ class FetchObsThread(threading.Thread): ...@@ -700,8 +700,8 @@ class FetchObsThread(threading.Thread):
self._logger.error(self._loggerprefix + "Could not remove files on observer, result was %d, error: %s" % (rs, err)) self._logger.error(self._loggerprefix + "Could not remove files on observer, result was %d, error: %s" % (rs, err))
else: else:
self._logger.debug(self._loggerprefix + "No files left to delete on observer.") self._logger.debug(self._loggerprefix + "No files left to delete on observer.")
else: #else:
self._logger.debug(self._loggerprefix + "No files to download from observer.") # self._logger.debug(self._loggerprefix + "No files to download from observer.")
if removelast == False: # this is the last execution of the while loop if removelast == False: # this is the last execution of the while loop
cmd = ['ssh' ,'%s'%(self._obsethernet), "rm -rf %s" % self._obstestresfolder] cmd = ['ssh' ,'%s'%(self._obsethernet), "rm -rf %s" % self._obstestresfolder]
......
...@@ -91,8 +91,7 @@ def test_startstopabort(testid=None, abort=False, delay=0): ...@@ -91,8 +91,7 @@ def test_startstopabort(testid=None, abort=False, delay=0):
logger.debug("Command executed was: %s"%(str(cmd2))) logger.debug("Command executed was: %s"%(str(cmd2)))
rs = errno.EALREADY rs = errno.EALREADY
else: else:
if debug: cmd.append('--debug')
cmd.append('--debug')
p = subprocess.Popen(cmd) p = subprocess.Popen(cmd)
p.wait() p.wait()
rs = p.returncode rs = p.returncode
...@@ -235,7 +234,7 @@ def main(argv): ...@@ -235,7 +234,7 @@ def main(argv):
flocklab.send_mail(subject="[FlockLab Scheduler] Missed test %d" % (testid), message=msg, recipients=owner_email) flocklab.send_mail(subject="[FlockLab Scheduler] Missed test %d" % (testid), message=msg, recipients=owner_email)
else: else:
logger.error("Error %s returned when trying to get test owner information" % str(rs)) logger.error("Error %s returned when trying to get test owner information" % str(rs))
logger.debug("Updated test status of %d missed tests to 'failed' and informed users." % nmissed) logger.warning("Updated test status of %d missed tests to 'failed' and informed users." % nmissed)
else: else:
logger.debug("No missed tests found.") logger.debug("No missed tests found.")
rs = errno.ENODATA rs = errno.ENODATA
...@@ -253,7 +252,7 @@ def main(argv): ...@@ -253,7 +252,7 @@ def main(argv):
testid = int(test[0]) testid = int(test[0])
dispatcher_pid = flocklab.get_dispatcher_pid(testid) dispatcher_pid = flocklab.get_dispatcher_pid(testid)
if dispatcher_pid != flocklab.FAILED: if dispatcher_pid != flocklab.FAILED:
logger.debug("Telling dispatcher with pid %d to abort test %d (status: %s)." % (dispatcher_pid, testid, test[1])) logger.warning("Telling dispatcher with pid %d to abort test %d (status: %s)." % (dispatcher_pid, testid, test[1]))
os.kill(dispatcher_pid, signal.SIGTERM) os.kill(dispatcher_pid, signal.SIGTERM)
# Release Lock --- # Release Lock ---
......
Supports Markdown
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