Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def execute(self, task_map):
if self.start_time is None:
self.start_time = datetime.now()
db.session.add(self)
db.session.commit()
try:
if task_map[self.command](self, **self.args):
self.complete(None)
return True
except (ValueError, LookupError, IOError, SocketError, HiredisError,
ProtocolError, ReplyError, RedisStatusError):
self.complete(traceback.format_exc())
return False