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))
|
||||
|
||||
|
||||
def available_servers():
|
||||
return [socket.gethostname()]
|
||||
|
||||
|
||||
class DashboardWindow:
|
||||
|
||||
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)
|
||||
break
|
||||
|
||||
hostname = self.server_proxy.hostname
|
||||
job_fetch = self.server_proxy.get_jobs()
|
||||
if job_fetch is not None:
|
||||
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
|
||||
self.job_tree.delete(*self.job_tree.get_children())
|
||||
self.job_cache = job_fetch # update the cache only if its good data
|
||||
for job in self.job_cache:
|
||||
display_status = job['status'] if job['status'] != 'running' else \
|
||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
||||
tags = (job['status'],)
|
||||
values = (job['id'],
|
||||
job['name'] or os.path.basename(job['input_path']),
|
||||
job['renderer'] + "-" + job['renderer_version'],
|
||||
job['priority'],
|
||||
display_status,
|
||||
job['time_elapsed'],
|
||||
job['total_frames'])
|
||||
try:
|
||||
if self.job_tree.exists(job['id']):
|
||||
update_row(self.job_tree, job['id'], new_values=values, tags=tags)
|
||||
else:
|
||||
self.job_tree.insert("", tk.END, iid=job['id'], values=values, tags=tags)
|
||||
except tk.TclError:
|
||||
pass
|
||||
# have to check hostname is still valid because of delay in fetching jobs
|
||||
if hostname == self.server_proxy.hostname:
|
||||
if job_fetch is not None:
|
||||
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
|
||||
self.job_tree.delete(*self.job_tree.get_children())
|
||||
self.job_cache = job_fetch # update the cache only if its good data
|
||||
for job in self.job_cache:
|
||||
display_status = job['status'] if job['status'] != 'running' else \
|
||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
||||
tags = (job['status'],)
|
||||
values = (job['id'],
|
||||
job['name'] or os.path.basename(job['input_path']),
|
||||
job['renderer'] + "-" + job['renderer_version'],
|
||||
job['priority'],
|
||||
display_status,
|
||||
job['time_elapsed'],
|
||||
job['total_frames'])
|
||||
try:
|
||||
if self.job_tree.exists(job['id']):
|
||||
update_row(self.job_tree, job['id'], new_values=values, tags=tags)
|
||||
else:
|
||||
self.job_tree.insert("", tk.END, iid=job['id'], values=values, tags=tags)
|
||||
except tk.TclError:
|
||||
pass
|
||||
|
||||
if clear_table:
|
||||
self.job_tree.delete(*self.job_tree.get_children())
|
||||
@@ -279,6 +278,10 @@ class DashboardWindow:
|
||||
|
||||
|
||||
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.mainloop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user