mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Wait for subjob completion and download render files to host (#17)
* Fix Blender image sequence -> video conversion and change video to use ProRes * Wait for child jobs to complete * Download and extract render files from subjobs * Fix issue where zip was not removed * Update client to use new method names in server proxy * Fix minor download issue
This commit is contained in:
@@ -10,6 +10,7 @@ from PIL import Image, ImageTk
|
||||
from lib.client.new_job_window import NewJobWindow
|
||||
from lib.server.server_proxy import RenderServerProxy
|
||||
from lib.server.zeroconf_server import ZeroconfServer
|
||||
from lib.workers.base_worker import RenderStatus
|
||||
from lib.utilities.misc_helper import launch_url, file_exists_in_mounts, get_time_elapsed
|
||||
|
||||
logger = logging.getLogger()
|
||||
@@ -82,7 +83,7 @@ class DashboardWindow:
|
||||
|
||||
# Setup the Tree
|
||||
self.job_tree = ttk.Treeview(server_frame, show="headings")
|
||||
self.job_tree.tag_configure('running', background='lawn green', font=('', 0, 'bold'))
|
||||
self.job_tree.tag_configure(RenderStatus.RUNNING.value, background='lawn green', font=('', 0, 'bold'))
|
||||
self.job_tree.bind("<<TreeviewSelect>>", self.job_picked)
|
||||
self.job_tree["columns"] = ("id", "Name", "Renderer", "Priority", "Status", "Time Elapsed", "Frames",
|
||||
"Date Added", "Parent", "")
|
||||
@@ -206,7 +207,7 @@ class DashboardWindow:
|
||||
def delete_job(self):
|
||||
job_ids = self.selected_job_ids()
|
||||
if len(job_ids) == 1:
|
||||
job = next((d for d in self.current_server_proxy.get_jobs() if d.get('id') == job_ids[0]), None)
|
||||
job = next((d for d in self.current_server_proxy.get_all_jobs() if d.get('id') == job_ids[0]), None)
|
||||
display_name = job['name'] or os.path.basename(job['input_path'])
|
||||
message = f"Are you sure you want to delete the job:\n{display_name}?"
|
||||
else:
|
||||
@@ -250,9 +251,9 @@ class DashboardWindow:
|
||||
self.set_image(self.default_image)
|
||||
|
||||
# update button status
|
||||
current_jobs = self.current_server_proxy.get_jobs() or []
|
||||
current_jobs = self.current_server_proxy.get_all_jobs() or []
|
||||
job = next((d for d in current_jobs if d.get('id') == job_id), None)
|
||||
stop_button_state = 'normal' if job and job['status'] == 'running' else 'disabled'
|
||||
stop_button_state = 'normal' if job and job['status'] == RenderStatus.RUNNING.value else 'disabled'
|
||||
self.stop_button.config(state=stop_button_state)
|
||||
|
||||
generic_button_state = 'normal' if job else 'disabled'
|
||||
@@ -261,16 +262,16 @@ class DashboardWindow:
|
||||
self.logs_button.config(state=generic_button_state)
|
||||
|
||||
def show_files(self):
|
||||
output_path = None
|
||||
if self.selected_job_ids():
|
||||
job = next((d for d in self.current_server_proxy.get_jobs() if d.get('id') == self.selected_job_ids()[0]), None)
|
||||
output_path = os.path.dirname(job['output_path']) # check local filesystem
|
||||
if not os.path.exists(output_path):
|
||||
output_path = file_exists_in_mounts(output_path) # check any attached network shares
|
||||
if output_path:
|
||||
launch_url(output_path)
|
||||
else:
|
||||
messagebox.showerror("File Not Found", "The file could not be found. Check your network mounts.")
|
||||
if not self.selected_job_ids():
|
||||
return
|
||||
|
||||
job = next((d for d in self.current_server_proxy.get_all_jobs() if d.get('id') == self.selected_job_ids()[0]), None)
|
||||
output_path = os.path.dirname(job['output_path']) # check local filesystem
|
||||
if not os.path.exists(output_path):
|
||||
output_path = file_exists_in_mounts(output_path) # check any attached network shares
|
||||
if not output_path:
|
||||
return messagebox.showerror("File Not Found", "The file could not be found. Check your network mounts.")
|
||||
launch_url(output_path)
|
||||
|
||||
def open_logs(self):
|
||||
if self.selected_job_ids():
|
||||
@@ -338,21 +339,24 @@ class DashboardWindow:
|
||||
if clear_table:
|
||||
self.job_tree.delete(*self.job_tree.get_children())
|
||||
|
||||
job_fetch = self.current_server_proxy.get_jobs(ignore_token=clear_table)
|
||||
job_fetch = self.current_server_proxy.get_all_jobs(ignore_token=clear_table)
|
||||
if job_fetch:
|
||||
for job in job_fetch:
|
||||
display_status = job['status'] if job['status'] != 'running' else \
|
||||
display_status = job['status'] if job['status'] != RenderStatus.RUNNING.value else \
|
||||
('%.0f%%' % (job['percent_complete'] * 100)) # if running, show percent, otherwise just show status
|
||||
tags = (job['status'],)
|
||||
start_time = datetime.datetime.fromisoformat(job['start_time']) if job['start_time'] else None
|
||||
end_time = datetime.datetime.fromisoformat(job['end_time']) if job['end_time'] else None
|
||||
|
||||
time_elapsed = "" if (job['status'] != RenderStatus.RUNNING.value and not end_time) else \
|
||||
get_time_elapsed(start_time, end_time)
|
||||
|
||||
values = (job['id'],
|
||||
job['name'] or os.path.basename(job['input_path']),
|
||||
job['renderer'] + "-" + job['renderer_version'],
|
||||
job['priority'],
|
||||
display_status,
|
||||
get_time_elapsed(start_time, end_time),
|
||||
time_elapsed,
|
||||
job['total_frames'],
|
||||
job['date_created'],
|
||||
job['parent'])
|
||||
|
||||
Reference in New Issue
Block a user