Commit 025f5c57 authored by Christopher Gearhart's avatar Christopher Gearhart

Added helpful information in terminal about why host servers didn't connect on 'refresh' action

parent 9a98ea27
......@@ -41,17 +41,32 @@ class refreshNumAvailableServers(Operator):
def checkNumAvailServers(self):
scn = bpy.context.scene
command = "ssh -T -oStrictHostKeyChecking=no -x {login} 'python {remotePath}blender_task -H --connection_timeout {timeout} --hosts_file {remotePath}servers.txt'".format(login=bpy.props.serverPrefs["login"], remotePath=bpy.props.serverPrefs["path"], timeout=scn.timeout)
command = "ssh -T -oStrictHostKeyChecking=no -x {login} 'python {remotePath}blender_task -Hv --connection_timeout {timeout} --hosts_file {remotePath}servers.txt'".format(login=bpy.props.serverPrefs["login"], remotePath=bpy.props.serverPrefs["path"], timeout=scn.timeout)
process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
return process
def updateAvailServerInfo(self):
scn = bpy.context.scene
line1 = self.process.stdout.readline().decode("ASCII").replace("\\n", "")
line2 = self.process.stdout.readline().decode("ASCII").replace("\\n", "")
available = json.loads(line1.replace("'", "\""))
offline = json.loads(line2.replace("'", "\""))
available = None
offline = None
while available is None:
try:
rl = self.process.stdout.readline()
line1 = rl.decode("ASCII").replace("\\n", "")
available = json.loads(line1.replace("'", "\""))
except:
print(line1, end="")
available = None
while offline is None:
try:
rl = self.process.stdout.readline()
line2 = rl.decode("ASCII").replace("\\n", "")
offline = json.loads(line2.replace("'", "\""))
except:
print(line2, end="")
offline = None
scn.availableServers = len(available)
scn.offlineServers = len(offline)
......
......@@ -107,7 +107,7 @@ class JobHost(threading.Thread):
def is_started(self):
return self.started
def print_job_status(self, state, job=None,verbose=1):
def print_job_status(self, state, job=None, verbose=1):
if self.verbose >= 2 or verbose >= 1:
pflush("Job {state} on host {hostname}".format(state=state, hostname=self.get_hostname()))
if self.verbose >= 2:
......@@ -210,7 +210,9 @@ class JobHost(threading.Thread):
tn = telnetlib.Telnet(self.hostname, 22, self.timeout)
self.reachable = True
return True
except:
except Exception as e:
if self.verbose >= 1:
print("Encountered following error connecting to '" + str(self.hostname) + "': " + str(e))
if self.reachable:
self.reachable_change = True
self.reachable = False
......
Markdown is supported
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