diff --git a/agents/pysmurf_monitor/pysmurf_monitor.py b/agents/pysmurf_monitor/pysmurf_monitor.py index eade0a7f7..505c2cd80 100644 --- a/agents/pysmurf_monitor/pysmurf_monitor.py +++ b/agents/pysmurf_monitor/pysmurf_monitor.py @@ -72,7 +72,7 @@ def __init__(self, agent, args): if db_host is not None: sql_config['host'] = db_host - self.dbpool = adbapi.ConnectionPool('mysql.connector', **sql_config) + self.dbpool = adbapi.ConnectionPool('mysql.connector', **sql_config, cp_reconnect=True) def _add_file_callback(self, res, d): """Callback for when a file is successfully added to DB""" @@ -81,7 +81,7 @@ def _add_file_callback(self, res, d): def _add_file_errback(self, failure: Failure, d): """Errback for when there is an exception when adding file to DB""" self.log.error(f"ERROR!!! {d['path']} was not added to the database") - return failure + self.log.error(f"Failure:\n{failure}") def datagramReceived(self, _data, addr): """ @@ -101,6 +101,9 @@ def datagramReceived(self, _data, addr): self.log.info("New file: {fname}", fname=data['payload']['path']) d = data['payload'].copy() + if (d['format'] == 'npy') and (not d['path'].endswith('.npy')): + d['path'] += '.npy' + # Adds additional db info to dict d['timestamp'] = datetime.datetime.utcfromtimestamp(d['timestamp']) d['md5sum'] = get_md5sum(d['path'])