mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-20 02:08:12 +00:00
Add job polish (#63)
* Remove legacy client * Misc cleanup * Add message box after submission success / fail * Use a new is_localhost method to handle localhost not including '.local' * Code cleanup * Fix issue where engine browser would think we're downloading forever * Add message box after submission success / fail * Use a new is_localhost method to handle localhost not including '.local' * Code cleanup * Fix issue where engine browser would think we're downloading forever * Add pubsub messages to serverproxy_manager.py * Add resolution, fps and renderer versions to add_job.py * Add cameras to add_job.py * Add message box after submission success / fail * Use a new is_localhost method to handle localhost not including '.local' * Code cleanup * Fix issue where engine browser would think we're downloading forever * Add message box after submission success / fail * Code cleanup * Add cameras to add_job.py * Add dynamic engine options and output format * Move UI work out of BG threads and add engine presubmission tasks * Submit dynamic args when creating a new job * Hide groups and show messagebox after submission * Choose file when pressing New Job in main window now
This commit is contained in:
@@ -418,7 +418,6 @@ def status():
|
||||
|
||||
@server.get('/api/renderer_info')
|
||||
def renderer_info():
|
||||
return_simple = request.args.get('simple', False)
|
||||
renderer_data = {}
|
||||
for engine in EngineManager.supported_engines():
|
||||
# Get all installed versions of engine
|
||||
@@ -426,10 +425,9 @@ def renderer_info():
|
||||
if installed_versions:
|
||||
install_path = installed_versions[0]['path']
|
||||
renderer_data[engine.name()] = {'is_available': RenderQueue.is_available_for_job(engine.name()),
|
||||
'versions': installed_versions}
|
||||
if not return_simple:
|
||||
renderer_data[engine.name()]['supported_extensions'] = engine.supported_extensions
|
||||
renderer_data[engine.name()]['supported_export_formats'] = engine(install_path).get_output_formats()
|
||||
'versions': installed_versions,
|
||||
'supported_extensions': engine.supported_extensions,
|
||||
'supported_export_formats': engine(install_path).get_output_formats()}
|
||||
return renderer_data
|
||||
|
||||
|
||||
@@ -542,7 +540,8 @@ def start_server():
|
||||
|
||||
# Set up the RenderQueue object
|
||||
RenderQueue.load_state(database_directory=server.config['UPLOAD_FOLDER'])
|
||||
DistributedJobManager.start()
|
||||
ServerProxyManager.subscribe_to_listener()
|
||||
DistributedJobManager.subscribe_to_listener()
|
||||
|
||||
thread = threading.Thread(target=eval_loop, kwargs={'delay_sec': Config.queue_eval_seconds}, daemon=True)
|
||||
thread.start()
|
||||
|
||||
@@ -8,6 +8,7 @@ import time
|
||||
import requests
|
||||
from requests_toolbelt.multipart import MultipartEncoder, MultipartEncoderMonitor
|
||||
|
||||
from src.utilities.misc_helper import is_localhost
|
||||
from src.utilities.status_utils import RenderStatus
|
||||
|
||||
status_colors = {RenderStatus.ERROR: "red", RenderStatus.CANCELLED: 'orange1', RenderStatus.COMPLETED: 'green',
|
||||
@@ -145,7 +146,7 @@ class RenderServerProxy:
|
||||
def post_job_to_server(self, file_path, job_list, callback=None):
|
||||
|
||||
# bypass uploading file if posting to localhost
|
||||
if self.hostname == socket.gethostname():
|
||||
if is_localhost(self.hostname):
|
||||
jobs_with_path = [{**item, "local_path": file_path} for item in job_list]
|
||||
return requests.post(f'http://{self.hostname}:{self.port}/api/add_job', data=json.dumps(jobs_with_path),
|
||||
headers={'Content-Type': 'application/json'})
|
||||
@@ -181,8 +182,8 @@ class RenderServerProxy:
|
||||
|
||||
# --- Renderer --- #
|
||||
|
||||
def get_renderer_info(self, timeout=5, simple=False):
|
||||
all_data = self.request_data(f'renderer_info?simple={simple}', timeout=timeout)
|
||||
def get_renderer_info(self, timeout=5):
|
||||
all_data = self.request_data(f'renderer_info', timeout=timeout)
|
||||
return all_data
|
||||
|
||||
def delete_engine(self, engine, version, system_cpu=None):
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from pubsub import pub
|
||||
from zeroconf import ServiceStateChange
|
||||
|
||||
from src.api.server_proxy import RenderServerProxy
|
||||
|
||||
|
||||
@@ -5,6 +8,21 @@ class ServerProxyManager:
|
||||
|
||||
server_proxys = {}
|
||||
|
||||
@classmethod
|
||||
def subscribe_to_listener(cls):
|
||||
"""
|
||||
Subscribes the private class method '__local_job_status_changed' to the 'status_change' pubsub message.
|
||||
This should be called once, typically during the initialization phase.
|
||||
"""
|
||||
pub.subscribe(cls.__zeroconf_state_change, 'zeroconf_state_change')
|
||||
|
||||
@classmethod
|
||||
def __zeroconf_state_change(cls, hostname, state_change, info):
|
||||
if state_change == ServiceStateChange.Added or state_change == ServiceStateChange.Updated:
|
||||
cls.get_proxy_for_hostname(hostname)
|
||||
else:
|
||||
cls.server_proxys.pop(hostname)
|
||||
|
||||
@classmethod
|
||||
def get_proxy_for_hostname(cls, hostname):
|
||||
found_proxy = cls.server_proxys.get(hostname)
|
||||
@@ -14,3 +32,4 @@ class ServerProxyManager:
|
||||
cls.server_proxys[hostname] = new_proxy
|
||||
found_proxy = new_proxy
|
||||
return found_proxy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user