fixed a bug where the barista server crashes if a new session is started with an unknown layer

fixed a bug where remote sessions where displayed as connected in the hostmanager after it was tried to import it but it failed due to an unknown layer
fixed a bug where the barisat server crashes if it has no caffe-version and a new session is created on that host
parent ce156157
......@@ -461,6 +461,17 @@ class Project(QObject, LogCaller):
def createRemoteSession(self, remote, state_dictionary=None):
"""use this only to create entirely new sessions. to load existing use the loadRemoteSession command"""
msg = {"key": Protocol.GETCAFFEVERSIONS}
reply = sendMsgToHost(remote[0], remote[1], msg)
if reply:
remoteVersions = reply["versions"]
if len(remoteVersions) <= 0:
msgBox = QMessageBox(QMessageBox.Warning, "Error", "Cannot create remote session on a host witout a caffe-version")
msgBox.addButton("Ok", QMessageBox.NoRole)
return None
sid = self.getNextSessionId()
msg = {"key": Protocol.CREATESESSION, "pid": self.projectId, "sid": sid}
......@@ -507,6 +518,7 @@ class Project(QObject, LogCaller):
msgBox = QMessageBox(QMessageBox.Warning, "Warning", msg)
msgBox.addButton("Ok", QMessageBox.NoRole)
return None
self.__sessions[sid] = session
......@@ -431,7 +431,7 @@ class ServerSession(QObject, ParserListener, SessionCommon):
msg["status"] = True
def save(self, includeProtoTxt = False):
def save(self, includeProtoTxt = False, errors = []):
"""Saves the current session to prototxt files and session_settings json file."""
res = self.__ensureDirectory()
if len(res) > 0:
......@@ -444,6 +444,7 @@ class ServerSession(QObject, ParserListener, SessionCommon):
if not type in availableTypes and not type in unknownLayerTypes:
if len(unknownLayerTypes) > 0:
return False
toSave = {"SessionState": self.state, "Iteration": self.iteration, "MaxIter": self.max_iter}
......@@ -703,9 +704,10 @@ class ServerSession(QObject, ParserListener, SessionCommon):
def _msgSave(self):
msg = self.transaction.asyncRead()
res =
msg["status"] = len(res) == 0
msg["error"] = res
error = []
ret = = error)
msg["status"] = ret
msg["error"] = error
def _takeSnapshot(self):
......@@ -865,7 +867,7 @@ class ServerSession(QObject, ParserListener, SessionCommon):
# TODO only one training per server
error = []
# (re-)write all session files
error.extend(, errors=error)
if not os.path.exists(self.logs):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment