mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Fix issue with jobs occasionally showing for the wrong server
This commit is contained in:
@@ -29,10 +29,6 @@ def make_sortable(tree):
|
|||||||
tree.heading(col, text=col, command=lambda c=col: sort_column(tree, c))
|
tree.heading(col, text=col, command=lambda c=col: sort_column(tree, c))
|
||||||
|
|
||||||
|
|
||||||
def available_servers():
|
|
||||||
return [socket.gethostname()]
|
|
||||||
|
|
||||||
|
|
||||||
class DashboardWindow:
|
class DashboardWindow:
|
||||||
|
|
||||||
lib_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
lib_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
@@ -238,29 +234,32 @@ class DashboardWindow:
|
|||||||
tree.item(item, values=new_values, tags=tags)
|
tree.item(item, values=new_values, tags=tags)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
hostname = self.server_proxy.hostname
|
||||||
job_fetch = self.server_proxy.get_jobs()
|
job_fetch = self.server_proxy.get_jobs()
|
||||||
if job_fetch is not None:
|
# have to check hostname is still valid because of delay in fetching jobs
|
||||||
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
|
if hostname == self.server_proxy.hostname:
|
||||||
self.job_tree.delete(*self.job_tree.get_children())
|
if job_fetch is not None:
|
||||||
self.job_cache = job_fetch # update the cache only if its good data
|
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
|
||||||
for job in self.job_cache:
|
self.job_tree.delete(*self.job_tree.get_children())
|
||||||
display_status = job['status'] if job['status'] != 'running' else \
|
self.job_cache = job_fetch # update the cache only if its good data
|
||||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
for job in self.job_cache:
|
||||||
tags = (job['status'],)
|
display_status = job['status'] if job['status'] != 'running' else \
|
||||||
values = (job['id'],
|
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
||||||
job['name'] or os.path.basename(job['input_path']),
|
tags = (job['status'],)
|
||||||
job['renderer'] + "-" + job['renderer_version'],
|
values = (job['id'],
|
||||||
job['priority'],
|
job['name'] or os.path.basename(job['input_path']),
|
||||||
display_status,
|
job['renderer'] + "-" + job['renderer_version'],
|
||||||
job['time_elapsed'],
|
job['priority'],
|
||||||
job['total_frames'])
|
display_status,
|
||||||
try:
|
job['time_elapsed'],
|
||||||
if self.job_tree.exists(job['id']):
|
job['total_frames'])
|
||||||
update_row(self.job_tree, job['id'], new_values=values, tags=tags)
|
try:
|
||||||
else:
|
if self.job_tree.exists(job['id']):
|
||||||
self.job_tree.insert("", tk.END, iid=job['id'], values=values, tags=tags)
|
update_row(self.job_tree, job['id'], new_values=values, tags=tags)
|
||||||
except tk.TclError:
|
else:
|
||||||
pass
|
self.job_tree.insert("", tk.END, iid=job['id'], values=values, tags=tags)
|
||||||
|
except tk.TclError:
|
||||||
|
pass
|
||||||
|
|
||||||
if clear_table:
|
if clear_table:
|
||||||
self.job_tree.delete(*self.job_tree.get_children())
|
self.job_tree.delete(*self.job_tree.get_children())
|
||||||
@@ -279,6 +278,10 @@ class DashboardWindow:
|
|||||||
|
|
||||||
|
|
||||||
def start_client():
|
def start_client():
|
||||||
|
|
||||||
|
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(module)s: %(message)s', datefmt='%d-%b-%y %H:%M:%S',
|
||||||
|
level='INFO'.upper())
|
||||||
|
|
||||||
x = DashboardWindow()
|
x = DashboardWindow()
|
||||||
x.mainloop()
|
x.mainloop()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user