mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
Add simple notifications on job errors, completion and start. (#46)
This commit is contained in:
@@ -4,10 +4,11 @@ import socket
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
from plyer import notification
|
||||
from pubsub import pub
|
||||
|
||||
from src.render_queue import RenderQueue
|
||||
from src.api.server_proxy import RenderServerProxy
|
||||
from src.render_queue import RenderQueue
|
||||
from src.utilities.misc_helper import get_file_size_human
|
||||
from src.utilities.status_utils import RenderStatus, string_to_status
|
||||
from src.utilities.zeroconf_server import ZeroconfServer
|
||||
@@ -55,6 +56,29 @@ class DistributedJobManager:
|
||||
# todo: handle cancelling all the children
|
||||
pass
|
||||
|
||||
# UI Notifications
|
||||
if new_status == RenderStatus.COMPLETED:
|
||||
logger.debug("show render complete notification")
|
||||
notification.notify(
|
||||
title='Render Job Complete',
|
||||
message=f'Render completed for {render_job.name}',
|
||||
timeout=10 # Display time in seconds
|
||||
)
|
||||
elif new_status == RenderStatus.ERROR:
|
||||
logger.debug("show render complete notification")
|
||||
notification.notify(
|
||||
title='Render Job Failed',
|
||||
message=f'Failed rendering {render_job.name}',
|
||||
timeout=10 # Display time in seconds
|
||||
)
|
||||
elif new_status == RenderStatus.RUNNING:
|
||||
logger.debug("show render complete notification")
|
||||
notification.notify(
|
||||
title='Render Job Started',
|
||||
message=f'Render started for {render_job.name}',
|
||||
timeout=10 # Display time in seconds
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def handle_subjob_status_change(cls, local_job, subjob_data):
|
||||
"""
|
||||
|
||||
@@ -33,10 +33,6 @@ class RenderQueue:
|
||||
def start_queue(cls):
|
||||
cls.load_state()
|
||||
|
||||
@classmethod
|
||||
def job_status_change(cls, job_id, status):
|
||||
logger.debug(f"Job status changed: {job_id} -> {status}")
|
||||
|
||||
@classmethod
|
||||
def add_to_render_queue(cls, render_job, force_start=False):
|
||||
logger.debug('Adding priority {} job to render queue: {}'.format(render_job.priority, render_job))
|
||||
|
||||
Reference in New Issue
Block a user